Name

fromto - perform string substitution on multiple files using the MySQL 'replace' command.

Synopsis


fromto [options] string_from string_to file(s)


Options

-t    Test. Do not actually change files.

-r    Recursively descend directories.

-f    Force (Skip sanity check).

--    Signals the end of options.

-h    Help.

Description

Fromto is a bash script that performs a string substitution on multiple files. The actual substitution is performed by the 'replace' command. This command is either found in MySQL or is the 'replace' command that comes with file-rename-utils (which is from MySQL-common-4.0.11 Mandrake 9.1). A log is printed to stdout, (and errors now go to stderr).

Examples

Swap all occurences of 'Foo' with 'Bar' in filenames ending in '.txt':
   fromto Foo Bar *.txt

Swap all occurences of "-p" with "-P":
   fromto -- -p -P *

Test recursively changing a version number:
   fromto -tr 9.1 9.2 SomeDirectory

Notes

If in doubt, use the test option "-t" before actually renaming files.

Symbolic links are handled thus: The 'replace' command will not change the original file - instead changing the 'link' to a 'copy' and performing the sustitution on this copy.

Bugs

If anyone finds any bugs, or incompatibilities with versions of bash > 2.05b, please report such to the author, thanks.

Author

Steven Atkinson (stevenaaus (at) yahoo (dot) com)