Created
August 15, 2012 09:37
-
-
Save gavD/3358134 to your computer and use it in GitHub Desktop.
VBScript to recursively remove spaces from filenames in a directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim fso : Set fso = WScript.CreateObject("Scripting.FileSystemObject") | |
sub fixFolder(path) | |
Dim fol : Set fol = fso.GetFolder(path) | |
For Each fil In fol.Files | |
If InStr(1, fil.Name, ".bxl") <> 0 Then | |
If InStr(1, fil.Name, " ") <> 0 Then | |
dim newName : newName = Replace(fil.Name, " ", "") | |
fil.Name = newName | |
End If | |
end if | |
Next | |
for each Subfolder in fol.SubFolders | |
fixFolder(Subfolder.Path) | |
next | |
end sub | |
fixFolder(".") | |
WScript.Echo "Completed!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment