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:
I wrote a script to make it a bit easier and more flexable:
# Hard part (lines 15 and 21) by Vaphell
#Last Updated: 04-Oct-2013 (Friday - yes see what I do on Firday nights) @ 23:37
#Put this in path and call it by typing batchrename in the terminal
echo "This script is for batch renaming files."
read -p "Enter the path to the folder containing the files. " path
read -p "Enter the file extension. " extension
echo "Press N if you want to use a new name or D if you want to use the date"
if [ "$x" = "D" ]
i=1; for f in *; do mv -- "$f" "$( printf "$( date +%d-%b-%Y )-%04d.$extension" $i )"; ((i++)); done
if [ "$x" = "N" ]
read -p "Enter the new base name: " new_name
i=1; for f in *; do mv -- "$f" "$( printf "$new_name-%04d.$extension" $i )"; ((i++)); done
#OK S11 - change this to Thunar
There are 9 alternatives - vote for the best!
If you can do better, submit your command here.
You must be signed in to comment.