mnmv Examples

Examples for mnmv. All examples have the pretend flag set so you can just copy and paste to try them out without risking messing up your files.

If you have a good example, add it on the MnmvExamples Wiki page.

File extensions

Change all "JPG" extension to "jpeg".

mnmv -p '\.JPG$' '.jpeg' *
        

Note that -p tells mnmv just to pretend to move the files. '\.JPG$' is the regexp to search for, (in this case .JPG at the end of the filename) '.jpeg' is the replacement, and * is the list of files to examine (in this case, all in current directory).

Next example, move files into directories organised by file extenstion. For example. "foo.txt" is moved to "txt/foo.txt" and "bar.html" to "html/bar.html".

mnmv -p '\(.*\)\.\(.*\)$' '\2/\1.\2' *
        

As above, but remove extension on target filename, so "foo.txt" goes to "txt/foo".

mnmv -p '\(.*\)\.\(.*\)$' '\2/\1' *
        

Reverse of the above, so "txt/foo" goes to "foo.txt".

mnmv -p '\(.*\)/\(.*\)' '\2.\1' */*
        

Organising MP3s

I name my MP3s like this: "Artist - Album - Tracknum - Title". Sometimes I have a bunch of MP3s from different albums/artists in the same directory and I want them moved so there is a directory for each artist, containing a directory for each album containing the MP3s. The following mnmv command renames MP3s named with the above format to "Artist/Artist - Album/Arist - Album - Tracknum - Title".

mnmv -p '^\([^-]*\) - \([^-]*\) - \(.*\)' '\1/\1 - \2/\1 - \2 - \3' *
        

As above, but files the MP3s by album only, no directory for artists.

mnmv -p '^\([^-]*\) - \([^-]*\) - \(.*\)' '\1 - \2/\1 - \2 - \3' *
        

Rename files with a filename "Tracknum. Name" to "Arist - Album - Tracknum - Name". Note that the album and artist are not in the original name, so you have to manually edit the target name to include them.

mnmv -p '\([^\.]*\)\. \(.*\)' 'Artist - Album - \1 - \2' *
        

Valid HTML 4.01! Valid CSS!

Contact Jim