It was not one of Explorer's design goals to provide a Turing-complete interface for bulk file renaming

Raymond Chen

Raymond

Somebody wanted to append an extension to all files in a directory and couldn’t find a way to do this type of bulk rename in Explorer. On the other hand, it’s pretty simple from the command prompt:

ren * *.ext

The person then asked, “Can we get this and other multi-file operations added to Explorer?”

  • “There should be a way to rename a large number of files, appending .ext to the name of each file (for example changing x to x.ext).”

  • “There should be a way to rename a large number of files, changing ABC to XYZ in each name (for example changing Customer_ABC_History.doc to Customer_XYZ_History.doc).”

  • “There should be a way to rename a large number of files, swapping the first two words in each file name (for example changing Bob Smith.vcf to Smith, Bob.vcf).”

  • “There should be a way to rename a large number of files, naming each file after the date and time it was created (for example IMG_2150.JPG becomes Photo December 25, 2004 0735am.JPG).”

  • “There should be a way to rename a large number of files, inserting the word (Provisional) after the first word (for example changing Recommendations for Smith account.doc to Recommendations (Provisional) for Smith account.doc.)”

  • “There should be a way to rename a large number of files, changing the case of each file name (for example changing Recommendations for Smith account.doc to Recommendations For Smith Account.doc.)” (Note that the above case change is incorrect, but computers don’t know that.)

  • “There should be a way to rename a large number of files, inserting the name of the album extracted from the mp3 metadata before the title (for example changing Tick Tock.mp3 to Beautiful Ride – Tick Tock.mp3.)”

It was not one of Explorer’s design goals to provide a Turing-complete interface for bulk file renaming. (Remember, you don’t know what you do until you know what you don’t do.)

Explorer does an extremely simple type of bulk rename: Renumbering a group of files. If that doesn’t suit your needs, you can use the command prompt.

ren * *.ext

Or you can write a batch file that does some editing before doing the rename.

for %%i in (*.doc) do call :fancy %%i
goto :eof
:fancy
set _=%1
ren %_% %_:ABC=XYZ%

You can generate a list of files to rename and then load it into your favorite editor to turn it into a batch file to execute.

dir /b *.vcf > files.cmd
vi files.cmd
:%s/^\([^ ]*\) \([^ ]*\)\(.*\)/ren "\1 \2\3" "\2 \1\3"
ZZ
files

Or you can write a program in your favorite language that does the most awesome-fancy renaming the world has ever seen.

0 comments

Comments are closed. Login to edit/delete your existing comments