Linux Mass Rename Recursively using a Bash Script
This example Bash script replaces “.JPG” with “.jpg” recursively in the current directory (It can handle filenames with spaces):
#!/bin/bash
find ./ -type f -name "*.JPG" | while read FILE
do
newname=`echo $FILE | sed s/.JPG/.jpg/`
echo $newname
mv "$FILE" "$newname"
done
Convert all characters to lowercase:
#!/bin/bash
find ./ -type f -name "*" | while read FILE
do
newname=`echo $FILE | tr 'a-z' 'A-Z'`
echo $newname
mv "$FILE" "$newname"
done
You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.
