Sub Globals
Private OldName As String
Private NewName As String
End Sub
Sub BtnTest_click
'Looks for file and renames it to lowercase even if already in lowercase as file.exists is case insensitive.
If File.Exists(File.DirRootExternal&"/ABT/","impsitelist.csv") = True Then 'Only run if file found "Name Case Insensitive"
Table.Initialize
Table = MF_File.ListFiles(File.DirRootExternal & "/ABT/", "*.*", True, False) 'Make list of all files
If Table.Size > 0 Then 'Only run if there is at least 1 file
For i = 0 To Table.Size -1
OldName = Table.Get(i)
NewName = OldName.ToLowerCase
If NewName = "impsitelist.csv" Then
Private Success As Boolean
Success=RenameFile(File.DirRootExternal&"/ABT/"&OldName, File.DirRootExternal&"/ABT/"&NewName)
If Success Then Exit
End If
Next
End If
End If
End Sub
Sub RenameFile(OriginalFileName As String, NewFileName As String) As Boolean
Dim Result As Int
Dim StdOut, StdErr As StringBuilder
StdOut.Initialize
StdErr.Initialize
Dim Ph As Phone
Result = Ph.Shell("mv " & OriginalFileName & " " & NewFileName, Null, StdOut, StdErr)
If Result = 0 Then
Return True
Else
Return False
End If
End Sub