In <[email protected]>, Marc Shapiro wrote: >I am sure that this is an easy question for those people who do any >reasonable amount of scripting. I'm just not one of them. > >How can I rename all of the files ina directory with the new name being >the old name stripped of its leftmost three characters. If all of the >files are off the format: > > xxxyyyyyyyyyyyyyyyyyyyyy.zzz > >I want the new names to be of the format: > > yyyyyyyyyyyyyyyyyyyyy.zzz
for f in *.zzz; do
echo mv "$f" "${f##???}"
done
If you are happy with the commands it outputs, remove the "echo".
You might also want to check for collisions first:
for f in *.zzz; do
printf '%s\n' "${f##???}"
done | sort | uniq -c | grep -v '^1 '
Should show any collisions, prefixed with a collision count.
--
Boyd Stephen Smith Jr. ,= ,-_-. =.
[email protected] ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-'
http://iguanasuicide.net/ \_/
signature.asc
Description: This is a digitally signed message part.

