This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ANNOUNCEMENT] Updated: cygutils-1.2.7-1

>    $ head -1 /usr/bin/rename
>    #!/usr/bin/perl -w

Yes, Debian includes a perl script /usr/bin/rename, which seems more 
powerful than Cygwin rename:

       rename - renames multiple files

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

       "rename" renames the filenames supplied according to the rule 
       specified as the first argument.  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 command 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/' *

This is a more powerful approach, because it uses Perl regexps.  OTOH, 
that makes it hard for non-Perl initiates to use.

Maybe this rename could also be included in Cygwin under a different 
name, say rename2 or prename.


Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]