in reply to Re: delete duplicates in windows subdirectories
in thread delete duplicates in windows subdirectories

I tried this and it doesn't get pushed to the array. I'm not sure if paths with spaces (" ") cause the push to fail

there was also where the file path is added and contains a forward slash instead of a backslash but I made a regex to flip it and it still didn't add to the array.
  • Comment on Re^2: delete duplicates in windows subdirectories

Replies are listed 'Best First'.
Re^3: delete duplicates in windows subdirectories
by cdarke (Prior) on Jan 03, 2010 at 17:22 UTC
    You need to start tracing the check_file subroutine. There is at least one questionable line in it:
    open FILE,$file || die "Cant open $file!\n";
    has a precedence problem. If the open fails then it will not execute the die (and we not not saying why the open failed). A better way is:
    open (FILE,$file) || die "Cant open $file: $!\n";
    or
    open FILE,$file or die "Cant open $file: $!\n";
    or even better
    open (my $fh, '<', $file) || die "Cannot open $file: $!";
    Then change the occurences of FILE to $fh.

    By the way, the extra '\' are required since '\' is a special character in perl strings (as in many languages). In most cases you can use '\\' or '/' in a Windows filename path, and even mix them in the same path. You probably do not need that RE.