in reply to rename files to upcase
NOTE: This is not a recursive solution. It also doesn't work on a case-insensitive OS - something like MacOS will need a more imaginative solution.use strict; use warnings; my ($old, $new); my $dir = "/u/web/hom420/test/"; die "Directory $dir does not exist" unless -e $dir; die "Directory $dir could not be opened" unless opendir(DIR, $dir); while ($old = readdir(DIR)) { next if -d $dir.$old; next if ($new = uc $old) eq $old; if (-e $dir.$new) { print "Collision: $old -> $new\n"; next; } rename $dir.$old, $dir.$new; }
|
|---|