[GRLUG] need some script help

Michael Mol mikemol at gmail.com
Thu Apr 18 17:25:47 EDT 2013


On 04/18/2013 05:15 PM, Don Ellis wrote:
> A Google search for <linux rename multiple files> yielded a number of
> helpful pages; this one specifically addressed spaces in file names:
> 
>     http://www.cyberciti.biz/tips/renaming-multiple-files-at-a-shell-prompt.html
> 
> A combination of the results could be extremely helpful, as each one
> addresses slight variations on the theme.
> 
> I especially looked up the rename command on the Mac - optional,
> available as a brew formula.
> 
> --Don Ellis

'rename' is available on Linux, as part of the 'util-linux' package.

man 1 rename results in:

RENAME(1)            User Commands           RENAME(1)



NAME
       rename - rename files

SYNOPSIS
       rename [options] expression replacement file...

DESCRIPTION
       rename  will  rename  the  specified  files  by
       replacing the first occurrence of expression in
       their name by replacement.

OPTIONS
       -v, --verbose
              Give  visual  feedback which files where
              renamed, if any.

       -V, --version
              Display version information and exit.

       -h, --help
              Display help text and exit.

EXAMPLES
       Given the files foo1, ...,  foo9,  foo10,  ...,
       foo278, the commands

              rename foo foo0 foo?
              rename foo foo0 foo??

       will   turn  them  into  foo001,  ...,  foo009,
       foo010, ..., foo278.  And

              rename .htm .html *.htm

       will fix the extension of your html files.

WARNING
       The renaming has no safeguards.   If  the  user
       has  permission to rewrite file names, the com‐
       mand will perform the action without any  ques‐
       tions.   For  example,  the result can be quite
       drastic when the command is run as root in  the
       /lib  directory.   Always  make a backup before
       running the command, unless you truly know what
       you are doing.

SEE ALSO
       mmv(1), mv(1)

AVAILABILITY
       The  rename  command  is part of the util-linux
       package and is  available  from  ftp://ftp.ker‐
       nel.org/pub/linux/utils/util-linux/.



util-linux             June 2011             RENAME(1)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 555 bytes
Desc: OpenPGP digital signature
URL: <http://shinobu.grlug.org/pipermail/grlug/attachments/20130418/09b1cda1/attachment.pgp>


More information about the grlug mailing list