1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!"C:\xampp\perl\bin\perl.exe" use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use File::Copy; print "Content-type: text/html\n\n"; opendir(Q, "D:/data/a_www/images_2021/categories") || die "Can't open directory: $!\n"; while (my $f = readdir(Q)) { if ($f ne "."){ if ($f ne ".."){ $original_file = $f; $new_file = "D:/data/a_www/images_2021/categories_2022/".$f; print "$original_file<br>\n"; print "$new_file<br>\n"; copy($original_file, $new_file) or die "The copy operation failed: $!"; } } } closedir(Q);