« My prrrreciousss | Hauptseite | Serie: was man(n) nicht brauchen kann Part4 »

File renamer for large file numbers

Today I was faced with the problem that I had to rename many files (about 10.000) from upper-case to lower-case. With the unix command line no bigger problem, but try it with Windows.
After a little research in the WWW in found this: 1-4a rename - a great tool for my needs.

If you are faced with the same problem try it - it is worth the minutes to get used to it and the good examples will serve you.

TrackBack

TrackBack-URL zu diesem Eintrag:
http://www.pccp.at/cgi-bin/mt/mt-tb.cgi/79

Kommentare (1)

Ein Arbeitskollege (Unix-Experte) hat mir ein geniales Shell-Skript geschrieben, dass diese Arbeit verfeinert und noch zusätzliches (CVS Arbeit) leistet.

Hier ist es:
#!/bin/sh

find 9PAAG7 9PAAH7 9PAAI7 -type f -name '*.[Jj][Pp][Gg]' | while read f
do
dir=$(dirname $f);
file=$(basename $f);

case "$file" in
*_innenraum*)
n1=$(echo $file | cut -c1-2 | tr '[:upper:]' '[:lower:]');
n2=$(echo $file | cut -c3-)
file_neu="$n1$n2";
;;
*)
file_neu=$(echo $file | tr '[:upper:]' '[:lower:]');
;;
esac

{
echo "cd $dir;"
echo "mv $file $file_neu;"
echo "cvs remove $file;"
echo "cvs add $file_neu;"
} | sh -x

done

Danke @Klemens :)

Über diese Seite

Diese Seite enthält einen einzelnen am 10.05.07 16:53 erschienenen Blogeintrag.

Zuvor erschien in diesem Blog My prrrreciousss.

Danach erschien Serie: was man(n) nicht brauchen kann Part4.

Viele weitere Einträge finden Sie auf der Hauptseite und im Archiv.

Creative Commons License
Dieser Weblog steht unter einer Creative Commons-Lizenz.
Powered by
Movable Type 5.12