Sven Guckes ©2002-2003

Latest change: Tue May 08 17:47:47 CEST 2018

greetings to: Gregor! :-)

mmv - move/copy/append/link multiple files by wildcard patterns

"mmv" is a small and yet powerful tool. it solves a whole lot of problems which are possible with other tools, too, but not as easy as with mmv.


Examples

adding a prefix/suffix to names:

mmv '*' 'prefix#1'
mmv '*' '#1suffix'

note: the "#1" refers to the match by the pattern '*'.

add a date string as prefix:
mmv '*' '2003-11-03.#1'

add a common filename extension as suffix:
mmv '*' '#1.jpg'

Example: Deleting/Removing Prefices/Suffices

removing prefix/suffix:

mmv 'foo-*' '#1'
mmv '*.txt' '#1'

this basically keeps only the part
which matches the '*' wildcard and
thereby loses the rest of the name.

Example: Change of Suffix

changing a suffix:
mmv '*.bar' '#1.foo'
the extension ".bar" is lost and the extension ".foo" is added.

Example: Changing text within

turning spaces into undersores:
mmv '* *' '#1_#2'

Note: This pattern matches the *first* space in the filename *only*. Therefore only the first match gets changed. Apply this command several times to replace all the spaces in the local filenames one by one.


Example: Lowercase/Uppercase Letters

Change filenames to lowercase (#l) completely:
mmv "*" "#l1"
make filenames uppercase (#u):
mmv "*" "#u1"

History

"mmv" was written by Vladimir Lanin and posted to comp.sources.unix in April 1990 (Volume 21, issues 87 and 88). I haven't seen any patches with improvements so maybe it is just a perfect tool. :-)


Links


http://www.prnet.de/RegEx/
1999-04-27: "I'm currently working on a "mmv" (Multiple Move) Command
for the Mac That will allow renames based on RegEx patterns.
If you're interested, drop me a note:  Anjo Krank ak(at)prnet.de"
seems the URL is dead.  pity.  but here's one that works:
http://download.com.com/3000-2207-907266.html
the file is only 53KB.

Sven Guckes webpage-mmv@guckes.net http://www.guckes.net/mmv/