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]
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
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
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(). `
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:
>
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;
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
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
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
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 ]
>
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
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
* 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
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
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 != $
15 matches
Mail list logo