I have 9873 files in a folder on hard-drive that are named as
myname-script.sql.001
myname-script.sql.002
- and so on
Now I need to rename these files to
myname-script.001.sql
myname-script.002.sql
- and so on
I want to name them all at once through command line.
Answer
You can use vbscript to rename
Set fso = CreateObject("Scripting.FileSystemObject")
set oFldr = fso.getfolder("C:\file\path")
for each ofile in oFldr.Files
splited = Split(ofile.Name, ".", -1, 1)
ofile.name = splited(0) & "." & splited(2) & "." & splited(1)
Next
This script will split your file name via the .
and then re-arrange it to swap the 2nd and 3rd extensions
No comments:
Post a Comment