I use a little script to numbering files. I start it with a thunar
custom action. This only works when all files are in the same directory. the new files name are 00001.ext
to 00005.ext
when I rename 5 files. krename
has an option to restart for every folder.
When i have this
/path/to/folder1/file1
/path/to/folder1/file2
/path/to/folder2/file1
/path/to/folder2/file2
my script would create this
/path/to/folder1/00001
/path/to/folder1/00002
/path/to/folder1/00003
/path/to/folder2/00004
^
folder two
What I want is
/path/to/folder1/00001
/path/to/folder1/00002
/path/to/folder1/00003
/path/to/folder1/00004
^
folder 1
is there a command line tool that can rename the files and restart for every new folder?
a=1 for i; do ext=${i##*.} new=$(printf "%05d.$ext" "$a") mv -i -- "$i" "$new" let a=a+1 done
– fmeier Feb 01 '24 at 16:26