Stupid me, I misunderstood a part of the post and assumed you wanted to delete files and make difference between extra zero's to the left of the value.
Anyway, I won't remove the post, it might be of some use.Old Post:
Hi there.
I once had to mass-delete files and made a VBS-script for it.
history::
It was meant to find .rar files names something like this: myfilePartXXXXXXX.rar
It roughly was about 5 million of them.
The reason I used a script was that any visual appearance or dos-reading of that directory made dos or windows crash.
The only way it didn't crash was when I entered the filename in a way I didn't have to view the whole directory.
So directly deleting it with dos did work, as long as I didn't view the directory it was in...
I didn't want to delete 5 million+ files by hand, so I decided to computalize it.
Here's the source (without comment tags for explanation, if you need help, just ask):
Set objFSO = CreateObject("Scripting.FileSystemObject")
x = 0
on error resume next
do until x = 5780350
If Len(x) = 1 Then
objFSO.DeleteFile "D:\program files\adfa2.part00000" &x &".rar"
x = x + 1
ElseIf Len(x) = 2 Then
objFSO.DeleteFile "D:\program files\adfa2.part0000" &x &".rar"
x = x + 1
ElseIf Len(x) = 3 Then
objFSO.DeleteFile "D:\program files\adfa2.part000" &x &".rar"
x = x + 1
ElseIf Len(x) = 4 Then
objFSO.DeleteFile "D:\program files\adfa2.part00" &x &".rar"
x = x + 1
ElseIf Len(x) = 5 Then
objFSO.DeleteFile "D:\program files\adfa2.part0" &x &".rar"
x = x + 1
End If
If x = 500 Then
msgbox "reached 500"
ElseIf x = 5000 Then
msgbox "reached 5K"
ElseIf x = 50000 Then
msgbox "reached 50K"
ElseIf x = 100000 Then
msgbox "reached 100K"
ElseIf x = 1000000 Then
msgbox "reached 1M"
ElseIf x = 5000000 Then
msgbox "Almost done..."
End If
loop
msgbox "done"
note, I already removed some extensive parts of this code which were irrelevant, but you can slim down the weird counting I used.
I only used that way because I had to fake some zero's on the left side of X, so that explains why I just added those in the string and made a check to decide which string to use.
Edited by IO-error, 16 November 2009 - 07:04 PM.