Subj : rename help under Linux To : Sean Dennis From : Arelor Date : Fri Dec 20 2024 09:35:43 Re: rename help under Linux By: Sean Dennis to All on Thu Dec 19 2024 10:42 pm > Hello everybody! > > I am trying to find a way under Linux to take files of various names and > extentions in a single directory to sequential filenames and not change the > extensions. > > After some research on the interwebz, part of the script is functioning: > > === Cut === > ## Rename files > cd ./pics > for i in *.*; do > new=$(printf "%04d.*" "${a}") #04 pad to length of 4 > mv -i -- "$i" "$new" > ((a++)) > done Quick one in ksh, try it for filenames that have no special characters and a single extension (ie no .tar.gz) i=0 for file in *; do extension=`echo "$file" | cut -d . -f 2` mv "$file" $i.$extension eval let i++ done -- gopher://gopher.richardfalken.com/1/richardfalken --- SBBSecho 3.23-Linux * Origin: Palantir * palantirbbs.ddns.net * Pensacola, FL * (618:250/24) .