Admittedly, some younger users out there may have never had a chance to work in the old command window that much (aka 'DOS' for us old-timers) in Windows, but it can be a very rewarding experience if you know what you are doing.The command-line has some very powerful ways for you to perform various system functions, and should not be underestimated, especially if you get into batch files.
The 'ren' (rename) command is very powerful.
Simply put, you use ren to rename a file from one name/extension to another. But, you can also use ren to rename groupings of files.
For example, to rename a file:
ren temp.txt test.old --> test.old
Rename a group of files, giving a suffix to every file:
ren *.bmp *_suffix.bmp
So, if you had a filename called 'leaf.bmp', it would now be renamed to 'leaf.bmp_suffix.bmp'.Removing the extension from all like files:
Don't like the extra extension? You could have done this:
ren *.bmp *.
This would essentially remove the extension from all .bmp files.Then you could re-run the suffix rename above, giving you 'leaf_suffix.bmp'.
Renaming with a prefix:
Renaming with a prefix isn't quite the same.
For example, if you ran this command:
ren *.bmp prefix*.bmp
You would see something like this:
testfile.bmp --> prefixe.bmp
testfile003.bmp --> prefixe003.bmp
test04.bmp --> prefix.bmp
vnc.bmp --> "A duplicate file name exists, or the file cannot be found"
Note that the third filename 'test04' is the same length as the word 'prefix', so it just renamed itself to 'prefix.bmp'. However, the fourth filename is less than the total characters found in the word 'prefix'. If we were renaming only this file, it would come out as 'prefix.bmp', but since we already have a file of that name, we can't rename this file.
So, the "ability" to renaming files easily to give it a prefix is rather underwhelming, but you can do something similar in Windows - see my tip about renaming multiple picture files here. Not to mention that you could write a batch file to do some tricky stuff as well.
Got any other nifty file rename tricks (No cheating! Only built-in commands to Windows allowed!)? Post them here!
5 comments:
I remember those days, and all I can say is -good riddance.
Command line work is just about the most tedious way to get anything done on a PC that I can possibly imagine - although, knowing a thing or two about it can come in handy at times...
I'm a software developer, and fellow developers who mouse around look on astonished as I get my work done much faster than they do.
Two secrets
- file associations - to view or edit a document all I have to do is type the name at the command prompt.
- batch files - an easily remembered TLA typed at the command line runs a simple batch file which replaces half a dozen mouse clicks
Thanks for this. ren *.bmp *. is a gem.
Install cygwin, add the cygwin\bin folder to your path variable and use unix commands on windows :D
Great tip. Command line isn't dead for those of use that still write scripts to automate things.
Post a Comment