[Gllug] Mass renaming of files
Tethys
tet at accucard.com
Wed May 7 17:31:15 UTC 2003
Simon Morris writes:
>a) Find all the files under a certain directory where the filename
>includes a :
>
>b) Rename these files to replace the : with a - or possibly remove the
>colon altogether.
#!/bin/sh
tmpfile=/tmp/foo.$$
trap '/bin/rm "$tmpfile"' 0 INT HUP QUIT TERM
find $HOME/tmp -name '*:*' -print > "$tmpfile"
while read file
do
newfile=`echo "$file" | tr : -`
mv "$file" "$newfile"
done < "$tmpfile"
Tet
--
Gllug mailing list - Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug
More information about the GLLUG
mailing list