NAME
mfn - The Moronic Filename Normalizer
SYNOPSIS
mfn [option]... [<tree>]
mdxi@fornax:~/tmp/JPEGZ4$ mfn
SEEN:589 RENAME:298 NOCLOB:1 FAILED:0
LOGFILE:/home/mdxi/.mfn/20050210T074901
mdxi@fornax:~/tmp/JPEGZ4$ cat /home/mdxi/.mfn/20050210T074901 | grep ^N
N /home/mdxi/tmp/JPEGZ4/hay guys.jpg (hay_guys.jpg)
mdxi@fornax:~/tmp/JPEGZ4$ display hay_guys.jpg
mdxi@fornax:~/tmp/JPEGZ4$ mv hay\ guys.jpg hay_guys2.jpg
DESCRIPTION
Applies a set of rules (via String::MFN
) to normalize filenames. Normalization occurs recursively, depth-first, from directory tree
. If tree
is not given, the current working directory is used.
WARNING: This utility is, by its nature, dangerous. Please read
the documentation completely and think carefully before using it.
OPTIONS
Options specified as (reversible) can have "no" prepended to their long forms to negate their values (e.g. --noclobber). This is useful when you have a default set in your config file and wish to override it for a single run.
- -c, --clobber (reversible)
-
By default, when a file's normalized name is the same as an existing file's name, both files are left untouched. If this option is specified, the existing file will be overwritten.
- -d, --no-dirs (reversible)
-
By default, any subdirectories of [DIR] will be normalized. If this option is specified, directories will be ignored
- -D, --dotfiles (reversible)
-
By default, dotfiles are not normalized. If this option is specified, they will be normalized as well
- -f, --fatal (reversible)
-
By default, failure to rename a file simply prints a warning to STDOUT and a failure notice to the logfile (if logging is enabled). When this is specified, failure to rename a file becomes a fatal error and mfn terminates.
- -l, --no-log (reversible)
-
Prevents a logfile from being written for this run
- -m, --media-only (reversible)
-
This instructs mfn to only normalize files with certain extensions. The default extensions list can be seen by running 'mfn --help'
- -M, --media-list <list>
-
Allows the user to specify a comma-separated list of extensions (e.g. '-M foo,bar,baz' '--media-list=foo,bar,baz') which override the default list
- -S, --silent
-
Supresses the printing of the end-of-run summary on STDOUT
- -u, --undo <logfile>
-
Reverses the set of changes listed in a logfile. <logfile> should be just the name of the desired log, not the complete path. <logfile> will be deleted at the end of the run unless --debug is also specified.
- --clean
-
Delete all logfiles.
- --debug (reversible)
-
Dry run. Everything happens except that no files are actually renamed.
- --dumpconf
-
Dumps current options as a YAML-formatted configuration file.
- --version
-
Prints the current revision of mfn to STDOUT.
- -h, --help
-
Prints a short usage guide to STDOUT.
FILES
Configuration File
mfn has a YAML configuration file which lives at "~/.mfn/mfnrc". The values in this file override mfn's hardcoded defaults, and are in turn overridden by values given on the command line. Sensical values for the config file (and their command line counterparts, where they differ) are as follows:
clobber [0.1]
debug [0,1]
dotfiles [0,1]
fatal [0,1]
media-list [List]
monly [0,1] (--media-only)
nodirs [0,1] (--no-dirs)
nolog [0,1] (--no-log)
silent [0,1]
verbose [0,1]
Logfiles
Any run of mfn which results in filesystem changes generates a logfile with a name in the format YYYYMMDDTHHMMSS, residing in the directory "~/.mfn". The format for these files is:
The character 'R', 'N', or 'F' followed by a single space
In the case of N (indicating noclobber) or F (indicating a failure), the space will be followed by the full path of the file in question. In the case of N, the filepath will then be followed by the mogrified form of the filename in parentheses.
In the case of R (successfully renamed), the space will be followed by the full path of the file. Then, on the next line will be two spaces and the full path of the renamed file.
BUGS
Logfile names have a granularity of one second. If a user manages to complete two or more runs within one second, all changes will appear in one logfile.
The current log cleaning code breaks in the year 3000.
You can make some pretty stupid things happen by specifying a retarded combination of options along with "--dumpconf".
AUTHOR
Copyright 2003,2004 by Shawn Boyette <mdxi@cpan.org>