hans

hans

【Shell】Batch Rename Files or Change File Extensions


Change File Extensions

Ubuntu 14.04

find . -name '*.JPEG' | awk -F "." '{print $2}' | xargs -I'{}' mv ./{}.JPEG ./{}.jpg

Ubuntu 18.04

find . -name '*.JPG' | awk -F "." '{print $2}' | awk -F "/" '{print $2}' | xargs -I'{}' mv ./{}.JPG ./{}.gif

Rename Files

rename 's/Content-to-be-Changed/Modified-Content/' filename

^ Start from the beginning

$ Start from the end

Alternatively, use

rename Content-to-be-Changed Modified-Content filename
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.