3 ms·
mmv (moves multiple files based on a simple pattern replacement language). Example: mmv "*.mp3" "old_#1.mp3" prefixes all files in the current directory e
by jsrn 18y ago
mmv (moves multiple files based on a simple pattern replacement language). Example:
mmv "*.mp3" "old_#1.mp3"
prefixes all files in the current directory ending with .mp3 with 'old_'. Btw., the quotes around the arguments are necesssary because mmv uses some of the same metacharacters as the shell does.
Multiple substitutions are allowed, e.g.:
$ mmv "*.*" "#1___#2"
renames blub.xyz to blub___xyz.
- nuclear_eclipse 18y agoI've been looking for something like that for years!
- moe 18y agoI commonly use qmv (from renameutils): qmv, qcp - Rename or copy files quickly, editing the file names in a text editor Found nothing better for bulk renames because you get to use all the pattern/replace power of your favorite editor instead of learning some wierd specialized grammar through trial & error. This is how to remove all spaces from mp3 filenames using vim: qmv -f do *.mp3 :%s/ /_/g :wq
- jsrn 18y agofor Emacs users, there is wdired mode, which makes a directory listing editable just like a normal Emacs buffer.
- yters 18y agoA lot of what I find lacking in a standard terminal, Emacs makes up for with its shell and terminal emulators. I find that an editable buffer with the contents of my entire session to be eminently powerful when combined with keyboard macros and the search/replace commands.
- puffythefish 18y agoHas anyone had any luck getting this to compile for OS X (Leopard)? make seems to fail on an error for me.
- mark_h 18y agoAndrew Myers has a shell script called mvsed that does something similar, using sed to specify the patterns. Found it: http://www.cs.cornell.edu/andru/useful.html http://www.cs.cornell.edu/andru/useful.html
- nickb 18y agoAnyone know where to find a source tarball that compiles under Leopard? All I've found is a bunch of precompiled Linux RPMs...
- deleted 18y ago[deleted]
- jsrn 18y agohm - no source tarball, but perhaps others find this Leopard binary useful: http://www.joel.lopes-da-silva.com/articles/computer-science-technology/tips-tricks/79-mmv-under-mac-os-x-leopard-for-mac-intel.html http://www.joel.lopes-da-silva.com/articles/computer-science... (including man pages etc.) Caveat: I didn't try it myself (I don't have Leopard).
- ruby_roo 18y agoUpdate your MacPorts. It was just added: http://trac.macports.org/changeset/46335 http://trac.macports.org/changeset/46335
- Erwin 18y agoThere's a 'rename' script that comes with Perl that also does this, which may be useful if you want some really fancy renames. E.g. rename '$_=lc' *.MP3 to change case to lowercase.
- jarekr 18y agoZsh has a module called zmv which lets you do things like: zmv '(??)-(*).mp3' '$1 - ${(C)2:gs/_/ }.mp3' Which would change "01-foo_bar_baz.mp3" into "01 - Foo Bar Baz.mp3"