in reply to How to rename to lowercase every file in a directory and its subdirectories?
#!/usr/bin/perl -w use strict; my $path_to_dir = shift; dir("$path_to_dir"); sub dir { rename "$_[0]","\L$_[0]"; $_[0]="\L$_[0]"; opendir(DIR,"$_[0]"); my @list_of_files = readdir(DIR); foreach(@list_of_files) { if($_ ne "." && $_ ne "..") { if(-d "$_[0]/$_") { dir("$_[0]/$_"); } else { rename "$_[0]/$_","$_[0]/"."\L$_"; } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Answer: How to rename to lowercase every file in a directory and its subdirectories?
by Happy-the-monk (Canon) on Sep 25, 2004 at 23:07 UTC |