I am running the fallowing script to rename files numerical with in all sub directories and sub directories.
num=1
echo "Enter the file path"
read -r path
cd $path
for file in $path/*.tif; do
mv -v "${file}" "$path/$(printf "%04d" ${num}).tif"
num=$(( ${num} + 1 ))
done
when I run the script it only runs on the root dir and not the sub directories as well? What can I add or is there a different way to write the script?
What I would do:
Or using Perl's
rename:Remove
-nswitch, aka dry-run when your attempts are satisfactory to rename for real.