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

Re: how to rename multiple files

There are also mmv, mcp, mad, and mln.  The syntax takes a little
getting used to, but once you get a feel for it, this is a nice set of
programs.  I think you can apt-get mmv.

Here's an example I used yesterday.  It takes a bunch of files
starting with week, then a 0 or a 1, then a single character, followed
by .gpg.out and moves them to a bunch of files named "week, first
match, second match, .cport.

 mmv "week[01]?.gpg.out"  "week#1#2.cport"

So, for example the file called week01.gpg.out is renamed
week01.cport.  The #1 matches the first wildcard in the from pattern,
here the '[01]'.  The #2 matches the single character wildcard.

One very nice thing about mmv, etc. is that if an error is detected
(for example, multiple files go to a destination with the same name),
the program doesn't do anything and tell you.  There is also a dryrun
flag for testing that things are going as you wish.  The man page is
quite detailed.  Give it a chance and read it a couple times.


Reply to: