recursively add file extension to all files
问题 I have a few directories and sub-directories containing files with no file extension. I want to add .jpg to all the files contained within these directories. I've seen bash scripts for changing the file extension but not for just adding one. It also needs to be recursive, can someone help please? 回答1: Alternative command without an explicit loop (man find): find . -type f -exec mv '{}' '{}'.jpg \; Explanation: this recursively finds all files ( -type f ) starting from the current directory (