diff options
| author | EverythingWindows <[email protected]> | 2022-11-19 06:54:01 +0700 |
|---|---|---|
| committer | EverythingWindows <[email protected]> | 2022-11-19 06:54:01 +0700 |
| commit | 1d1722345b99abe7f52e999994ccb3e088cbd3c2 (patch) | |
| tree | 327c1bd028102ddcec8c71d8a5229740f35f089e /ShiftOS-TheRevival/TerminalApplications/Internal/Com_Rename.vb | |
| parent | e73d05d3b013924c89c6c8824f8bf338ec52ffbd (diff) | |
| download | shiftos-therevival-old-1d1722345b99abe7f52e999994ccb3e088cbd3c2.tar.gz shiftos-therevival-old-1d1722345b99abe7f52e999994ccb3e088cbd3c2.tar.bz2 shiftos-therevival-old-1d1722345b99abe7f52e999994ccb3e088cbd3c2.zip | |
Rename function implemented
Diffstat (limited to 'ShiftOS-TheRevival/TerminalApplications/Internal/Com_Rename.vb')
| -rw-r--r-- | ShiftOS-TheRevival/TerminalApplications/Internal/Com_Rename.vb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/ShiftOS-TheRevival/TerminalApplications/Internal/Com_Rename.vb b/ShiftOS-TheRevival/TerminalApplications/Internal/Com_Rename.vb new file mode 100644 index 0000000..43c79a1 --- /dev/null +++ b/ShiftOS-TheRevival/TerminalApplications/Internal/Com_Rename.vb @@ -0,0 +1,34 @@ +Imports System.IO + +Module Com_Rename + Public ShouldRename As Boolean + + Public Sub Rename() + Dim Names() As String = command.Split("''") + If Names(1) = "" Then + NewLine("No filename has been inputted") + ShouldRename = False + ElseIf Names(1) Like " *" Then + NewLine("Filename cannot be started with spaces") + ShouldRename = False + Else + ShouldRename = True + End If + If Names(3) = "" Then + NewLine("No new filename has been inputted") + ShouldRename = False + ElseIf Names(3) Like " *" Then + NewLine("Filename cannot be started with spaces") + ShouldRename = False + Else + ShouldRename = True + End If + If ShouldRename = True Then + If File.Exists(Console.CurrentDirectory & "\" & Names(1)) = True Then + FileSystem.Rename(Console.CurrentDirectory & "\" & Names(1), Console.CurrentDirectory & "\" & Names(3)) + Else + NewLine("File is not exist") + End If + End If + End Sub +End Module |
