Re: Uppercasing filenames

2003-09-21 Thread Jeff Elkins
Thanks for the tips, folks. This will help me avoid a PITA recurring task... Jeff -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Re: Uppercasing filenames

2003-09-21 Thread Ashish Ariga
On Sun, 2003-09-21 at 02:57, Michael D Schleif wrote: > Jeff Elkins <[EMAIL PROTECTED]> [2003:09:20:17:06:26-0400] scribed: > > I need to convert a bunch of filenames to uppercase. I tried the script below, > > which does...nothing. > > > > #!/bin/sh > > for file in $* > > do > > if [ -f $file

Re: Uppercasing filenames

2003-09-20 Thread Wilko Fokken
On Sat, Sep 20, 2003 at 05:06:26PM -0400, Jeff Elkins wrote: > I need to convert a bunch of filenames to uppercase. I tried the script below, > which does...nothing. > > #!/bin/sh > for file in $* > do > if [ -f $file ] > then > ucfile=`echo $file | tr [a-z] [A-Z]` > if [ $file != $ucfile

Re: Uppercasing filenames

2003-09-20 Thread Colin Watson
On Sat, Sep 20, 2003 at 07:34:37PM -0400, Bijan Soleymani wrote: > On Sat, Sep 20, 2003 at 05:52:44PM -0400, Bijan Soleymani wrote: > > #!/usr/bin/perl > > @files=`ls`; > > foreach $file (@files) > > { > > chomp $file; Instead of this, it's better to use opendir(), readdir(), and writedir(). `

Re: Uppercasing filenames

2003-09-20 Thread Nathan Poznick
Thus spake Bijan Soleymani: > On Sat, Sep 20, 2003 at 05:52:44PM -0400, Bijan Soleymani wrote: > > #!/usr/bin/perl > > @files=`ls`; > > foreach $file (@files) > > { > > chomp $file; > > if(-f $file) > > { > > $newname = uc $file; > > `mv $file $newname`; > oops that should be: >

Re: Uppercasing filenames

2003-09-20 Thread Kirk Strauser
At 2003-09-20T23:34:37Z, Bijan Soleymani <[EMAIL PROTECTED]> writes: > oops that should be: > `mv "$file" "$newname"`; > So that files with spaces won't screw up. That won't work either. Suppose that $file contains a doublequote? If you're in Perl anyway, use: rename $file, $newname;

Re: Uppercasing filenames

2003-09-20 Thread Clive Standbridge
On Sat 20 Sep 2003 17:06:26 +(-0400), Jeff Elkins wrote: > I need to convert a bunch of filenames to uppercase. I tried the script below, > which does...nothing. > > #!/bin/sh > for file in $* > do > if [ -f $file ] > then > ucfile=`echo $file | tr [a-z] [A-Z]` > if [ $file != $ucfile

Re: Uppercasing filenames

2003-09-20 Thread Clive Standbridge
On Sat 20 Sep 2003 23:35:34 +(+0200), Nicos Gollan wrote: > Let's ignore the scripts intended purpose for a while and talk about what will > happen when it's trying to process a filename with a space character... > > Quote all uses of variables: > > if [ -f "$file" ] > > Otherwise, if you

Re: Uppercasing filenames

2003-09-20 Thread Bijan Soleymani
On Sat, Sep 20, 2003 at 05:52:44PM -0400, Bijan Soleymani wrote: > #!/usr/bin/perl > @files=`ls`; > foreach $file (@files) > { > chomp $file; > if(-f $file) > { > $newname = uc $file; > `mv $file $newname`; oops that should be: `mv "$file" "$newname"`; So that files

Re: Uppercasing filenames

2003-09-20 Thread Carla Schroder
On Saturday 20 September 2003 2:06 pm, Jeff Elkins wrote: > I need to convert a bunch of filenames to uppercase. I tried the script > below, which does...nothing. > > #!/bin/sh > for file in $* > do > if [ -f $file ] > then > ucfile=`echo $file | tr [a-z] [A-Z]` > if [ $file != $ucfile ] >

Re: Uppercasing filenames

2003-09-20 Thread Robert Vollmert
On Sat, Sep 20, 2003 at 05:06:26PM -0400, Jeff Elkins wrote: > I need to convert a bunch of filenames to uppercase. I tried the script below, > which does...nothing. While we're at it: $ rename tr/a-z/A-Z/ * -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Troub

Re: Uppercasing filenames

2003-09-20 Thread Bijan Soleymani
On Sat, Sep 20, 2003 at 05:06:26PM -0400, Jeff Elkins wrote: > I need to convert a bunch of filenames to uppercase. I tried the script below, > which does...nothing. > > #!/bin/sh > for file in $* > do > if [ -f $file ] > then > ucfile=`echo $file | tr [a-z] [A-Z]` > if [ $file != $ucfile

Re: Uppercasing filenames

2003-09-20 Thread David J. Weller-Fahy
* Jeff Elkins <[EMAIL PROTECTED]> [2003-09-20 13:07]: > I need to convert a bunch of filenames to uppercase. I tried the > script below, which does...nothing. > > #!/bin/sh > for file in $* > do > if [ -f $file ] > then > ucfile=`echo $file | tr [a-z] [A-Z]` > if [ $file != $ucfile ] > the

Re: Uppercasing filenames

2003-09-20 Thread Nicos Gollan
On Saturday 20 September 2003 23:06, Jeff Elkins wrote: > I need to convert a bunch of filenames to uppercase. I tried the script > below, which does...nothing. > > #!/bin/sh > for file in $* > do > if [ -f $file ] > then > ucfile=`echo $file | tr [a-z] [A-Z]` > if [ $file != $ucfile ] > t

Re: Uppercasing filenames

2003-09-20 Thread Michael D Schleif
Jeff Elkins <[EMAIL PROTECTED]> [2003:09:20:17:06:26-0400] scribed: > I need to convert a bunch of filenames to uppercase. I tried the script below, > which does...nothing. > > #!/bin/sh > for file in $* > do > if [ -f $file ] > then > ucfile=`echo $file | tr [a-z] [A-Z]` > if [ $file != $