[OOZY] Renaming more than 200 pics

Sridhar M.A. mas at mylug.org
Mon May 8 01:54:52 UTC 2006


On Sun, May 07, 2006 at 08:26:13PM +0300, OOzy Pal wrote:
   > As you all know that Linux puts a backslash \ before spaces in files
   > names. I  would like to rename all my pictures. Basically I would like
   > to convert each space in a file name to a dash. How can I do this from
   > the command line.
   > 
In addition to the answers you have already received, I would suggest
you to have a look at the perl program rename which must already be on
your system.

From the manpage:

RENAME(1)                        Perl Programmers Reference Guide                       RENAME(1)

NAME
       rename - renames multiple files

SYNOPSIS
       rename [ -v ] [ -n ] [ -f ] perlexpr [ files ]

DESCRIPTION
       "rename" renames the filenames supplied according to the rule specified as the first argu-
       ment.  The perlexpr argument is a Perl expression which is expected to modify the $_
       string in Perl for at least some of the filenames specified.  If a given filename is not
       modified by the expression, it will not be renamed.  If no filenames are given on the com-
       mand line, filenames will be read via standard input.

       For example, to rename all files matching "*.bak" to strip the extension, you might say

               rename 's/\.bak$//' *.bak

       To translate uppercase names to lower, you'd use

               rename 'y/A-Z/a-z/' *

Regards,

-- 
Sridhar M.A.                                 GPG KeyID : F6A35935
  Fingerprint: D172 22C4 7CDC D9CD 62B5  55C1 2A69 D5D8 F6A3 5935

Don't go around saying the world owes you a living.  The world owes you
nothing.  It was here first.
		-- Mark Twain
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 191 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20060508/4d837c2c/attachment.sig>


More information about the ubuntu-users mailing list