linux:files:rename_file_extension_recursively
Linux - Files - Rename file extension recursively
Rename all JPG file extensions to JPEG, recursively and handles sub-directories also.
#!/bin/bash function rename_extension { # Change all .jpg to .jpeg, for file in $1/*.jpg; do mv $file $1/`basename $file .jpg`.jpeg; echo $file; done; # Recurse directories. for d in $1/*; do if test -d $d; then rename_extension $d; fi; done; } dir=`pwd`; rename_extension $dir;
linux/files/rename_file_extension_recursively.txt · Last modified: 2023/07/17 17:50 by peter