[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: scripting question

Marc Shapiro <mshapiro_42@yahoo.com> writes:
> 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
> I have hundreds of files like this in each of several directories and
> I really don't want to do it all by hand.  I did some of that,
> already, and I know there must be a better way.

In ZSH with zmv, you can do it with the following:

$ zmv 'xxx(*).zzz' '$1.zzz'

- Michael

mouse, n: A device for pointing at the xterm in which you want to type.
Confused by the strange files?  I cryptographically sign my messages.
For more information see <http://www.elehack.net/resources/gpg>.

Reply to: