TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:8884] converting uppercase to lowercase



Carl,

Change your: 

	foreach $filename(@ARGV) {
	...
	}

to:

	while (<>) {
	...
	}

and try it again. Good luck,

Troy


Carl Wilhelm Soderstrom wrote:
> 
>         I have a directory tree full of files; the filenames are all in
> uppercase.
>         I wish all the filenames to be lowercase
>         I have a perl script (named mklc) that will convert uppercase to
> lowercase filenames:
> 
> #!/usr/bin/perl
> foreach $filename(@ARGV) {
>         $newfilename = lc($filename);
>         print "$filename -> $newfilename\n";
>         rename ($filename, $newfilename);
>         }
> 
>         how do I make it recurse the entire tree, tho; and convert the
> filenames?
>         I tried 'find . -depth| mklc ' and 'find . -depth| mklc * ' but it
> gives me a 'broken pipe' error both times. so obviously the output is not
> getting from 'find' to 'mklc'.
>         I don't know perl very well (the script was written with the help of
> ppl on this list); and I forget what the '(@ARGV)' means. I think it's an
> array made from stdin; but don't really have a clue.
> 
>         where am I going wrong?
> 
> Carl Soderstrom
> System Administrator    307 Brighton Ave.
> Minnesota DHIA          Buffalo, MN
> carls@agritech.com      (612) 682-1091
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tclug-list-unsubscribe@mn-linux.org
> For additional commands, e-mail: tclug-list-help@mn-linux.org