Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- test data:
- ========
- $ find -type f
- ./foo/bar3
- ./foo/blah3.jpg
- ./foo/blah2.JPG
- ./blah.JPG
- script:
- ========
- # the next IFS= line makes the find work for spaces,
- # so only new lines in find output will separate file names
- IFS=$'\n'
- for name in $(find -type f -name "*.JPG"); do
- oldname=$(basename "$name")
- dir=$(dirname "$name")
- newname=$(echo "$oldname" | sed -r "s/\.JPG/.jpg/")
- echo "mv \"$name\" \"$dir/$newname\""
- done
- output:
- ========
- mv "./foo/blah2.JPG" "./foo/blah2.jpg"
- mv "./blah.JPG" "./blah.jpg"
Advertisement
Add Comment
Please, Sign In to add comment