[Klug-general] Space to underscore?

Paul Littlefield info at paully.co.uk
Tue May 15 12:13:30 UTC 2012


I use a lovely little command-line program called 'rename'.

Now in Gentoo it's this package...
paully at thinkpad ~ $ eix -I rename
[I] sys-apps/rename
      Available versions:  1.3
      Installed versions:  1.3(21:58:46 02/07/11)
      Homepage:            http://rename.berlios.de/
      Description:         tool for easily renaming files

which actually calls the tiny binary renamexm (for compatibility reasons)

paully at thinkpad ~ $ which renamexm
/usr/bin/renamexm

paully at thinkpad ~ $ ll /usr/bin/renamexm
-rwxr-xr-x 1 root root 14K 2011-07-02 21:58 /usr/bin/renamexm

You then use it as follows:-

paully at thinkpad ~ $ renamexm -h
Usage: renamexm SOURCE DEST
    or: renamexm [OPTION] file ...
Rename SOURCE to DEST, or substitute characters match the specified pattern
in the filename.

   -l, --lowcase            lowcase the file names
   -u, --upcase             upcase the file names
   -s/PATTERN/STRING[/sw]   replace matching PATTERN with STRING, [sw] is
                            [g] replace all occurrences in the filename
                            [i] ignore case when searching
                            [b] backward searching and replacing
                            [s] change file's suffix name
                            [r] PATTERN is regular expression
                            [e] PATTERN is extended regular expression
   -R, --recursive          operate on files and directories recursively
   -o, --owner  OWNER       change file's owner (superuser only)
   -v, --verbose            display verbose information
   -t, --test               test only
   -h, --help               display this help and exit
   -V, --version            output version information and exit
       --yes  --no          force to choose YES or NO when target exists

See man page regex(7) for detail information about extended regular expression.

Report bugs to <xuming at bigfoot.com>.



Example...


renamexm -R /home/foo/Music -s/" "/"_"/ *.mp3



:-)

Paully



More information about the Kent mailing list