On Sat, 19 Feb 2005 16:40:43 +0800, xuantl <[EMAIL PROTECTED]> wrote:
Hi all,
Hi
I wan't to change name of all the files in a directory(incluing sub directorys) to lowercase.
[snip]
But it only works for files in the top directory("."), and no effect to all other files in sub directorys. Any help? I'm a beginner. If it's a stupid question for you, please don't hit me!
Try using finddepth() instead of find() With find(), you're going to get DIR/ DIR/file1 DIR/file2 If you rename DIR to dir, DIR/file1 no longer exists.
But finddepth returns directory contents before the directories themselves.
BTW your code would have been clear, btw, if you'd said, for example: rename $old, $new or warn "rename: $!\n";
also, "$new = lc $old" is more readable than $new = "\L$old"
My suggestion is untested, it'll be nice if you let us know if it works ;-)
HtH
-- Edward WIJAYA Singapore
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>