sub lc_filenames{ my($dir)=@_; $dir||="./"; #sets to current directory if it wasn't passed a param +eter opendir DIR, $dir; while(defined($file=readdir DIR)){ if(-f ($dir.$file)){ if($file=~/[A-Z]/){ $newname=lc($file); if(-e ($dir.$filename)){ print "File exists. Replace it? Y/N\n"; if(<> and /^y/i){ rename($dir.$file,$dir.$newname); } } else{ rename($dir.$file,$dir.$newname); } } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Lowercases all filenames within a directory
by Anonymous Monk on Feb 25, 2000 at 18:49 UTC | |
by vroom (His Eminence) on Feb 25, 2000 at 21:18 UTC | |
|
RE: Lowercases all filenames within a directory
by Anonymous Monk on Mar 03, 2000 at 10:04 UTC | |
by vroom (His Eminence) on Mar 03, 2000 at 10:13 UTC |