commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
This command will take the files in a directory, rename them, and then number them from 1...N.
Black belt stuff.
Hell of a time saver.
There are 2 alternatives - vote for the best!
The '1' in '%01d' changes the amounts of digits in the integer, eg. 1 vs 0001.
zsh example using a 'for' loop and arithmetic expression:
files matching the pattern '*.jpg' are renamed with a 3 digit prefix, keeping the previous filename and suffix.
If you can do better, submit your command here.
You must be signed in to comment.