BEGIN { use strict; use File::Next; use File::Util; use File::Copy; } my ($file_util) = File::Util->new(); move_files() sub move_files { open (FILE, ") { next if ($_ !~ /\w/); my ($full_path) = ($_ =~ /\d*\s(.*)/); my ($par_dir, $file_name) = ($full_path =~ /.*\\(.*)\\(.*)/); my ($file_no_ext) = ($file_name =~ /(.*)\.pdf/); my ($first_five) = ($file_no_ext =~ /(\d{5}).*/); $first_five .= 'xxx'; if ($par_dir =~ $file_no_ext) { my $directory = "\\\\filervoca\\e\$\$\\activeads\\adwatchfolders\\$first_five\\$file_no_ext"; #print "path: $full_path\npar_dir: $par_dir\nfile_name: $file_name\nfirst_five: $first_five\ndirectory: $directory\n"; #print "dir doesn't exist, need to make it\n"; $file_util->make_dir($directory, '--if-not-exists') or die "$!"; copy($full_path, "$directory\\$file_no_ext"."00.pdf") or die (print "$!"); } sleep 10; } close FILE; } #### PROCESS TERMINATED DUE TO ERRORS File::Util can't use this string for (weird character)the name of a directory1/2. (same weird character)\\filervoca\e$$\activeads\adwatchfolders\00232xxx\00232351(1/2) It contains illegal characters. Illegal characters are: \ (backslash) / (forward slash) : (colon) | (pipe) * (asterisk) ? (question mark) " (double quote) < (less than) > (greater than) \t (tab) \ck (vertical tabulator) \r (newline CR) \n (newline LF) Origin: This is a human error. Solution: A human must remove the illegal characters from this string. ARG _pak = File::Util ARG purpose = the name of a directory ARG string = \\filervoca\e$$\activeads\adwatchfolders\00232xxx\00232351 1. File::Util::_throw -called at line(1322) of blib\lib\File\Util.pm --was called with args --was not called to evaluate anything 2. File::Util::make_dir - called at line (45) of findpdfs.pl --was called with args --was not called to evaluate anything 3. main::move_files -called at line (11) of findpdfs.pl --was called with args --was not called to evaluate anything