Hi there,
for building a DB catalogue of my 30+ USB sticks to better remember where to find old stuff, I would like to rename some of the display names (other than manually in properties of the explorer).
I started with Erel's files treeview and found RunMethod("getSystemDisplayName"... in the forum but not the corresponding set, modify or create the name.
This is essential to avoid confusion and duplicates. Alternatively I could live with a serial number if such a thing existed
Also it would be nice to show the sizes of each folder so that I would not have to loop through the entire file list. The only fx command I found just tells me the amount of unused space on stick. There must be a fx method for that, but how to find and implement it?
Any help will be greatly appreciated and thanks in advance,
johnmie
Private Sub RenameDrive (Drive As String, NewName As String) As ResumableSub
Dim shl As Shell
shl.Initialize("shl", File.Combine(GetEnvironmentVariable("windir", "N/A"), "System32\label.exe"), Array(Drive, NewName))
shl.Run(-1)
Wait For shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
Log(StdOut)
Log(StdErr)
Return Success And ExitCode = 0
End Sub
Usage:
B4X:
Wait For (RenameDrive("H:", "Test3")) Complete (Success As Boolean)
Log("renamed successfully? " & Success)
Private Sub RenameDrive (Drive As String, NewName As String) As ResumableSub
Dim shl As Shell
shl.Initialize("shl", File.Combine(GetEnvironmentVariable("windir", "N/A"), "System32\label.exe"), Array(Drive, NewName))
shl.Run(-1)
Wait For shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
Log(StdOut)
Log(StdErr)
Return Success And ExitCode = 0
End Sub
Usage:
B4X:
Wait For (RenameDrive("H:", "Test3")) Complete (Success As Boolean)
Log("renamed successfully? " & Success)
Private Sub RenameDrive (Drive As String, NewName As String) As ResumableSub
Dim shl As Shell
shl.Initialize("shl", File.Combine(GetEnvironmentVariable("windir", "N/A"), "System32\label.exe"), Array(Drive, NewName))
shl.Run(-1)
Wait For shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
Log(StdOut)
Log(StdErr)
Return Success And ExitCode = 0
End Sub
Usage:
B4X:
Wait For (RenameDrive("H:", "Test3")) Complete (Success As Boolean)
Log("renamed successfully? " & Success)