in reply to File::Find giving unexpected results under windows

How are you creating the Junction? Are you using the sysinternals tool? http://technet.microsoft.com/en-us/sysinternals/bb896768
It seems to work for me. You mentioned "cloning" at first, what method are you using to create your clone?
A slightly more tedious alternative to File::Find is opendir/readdir/closedir.

Not releated to your question, but be careful of using :
sub process()
The parentheses are a prototype and mean that no arguments should be passed. That prototype is ignored here because the subroutine is defined after the call, and the call is through a reference, so prototypes are ignored. If you check the File::Find documentation and the example "wanted" subroutine it is not declared with a prototype.

Replies are listed 'Best First'.
Re^2: File::Find giving unexpected results under windows
by Joel (Novice) on Feb 15, 2011 at 13:28 UTC
    Thanks for the tip on the prototype - perl is new to me. The ()'s got added out of habit.

    I'm not creating the junctions, windows did. The way I found out what they were was a DIR in the correct directory - someone pointed out in the chatterbox that I had done my initial DIR in the wrong directory, so here is the right one

    C:\Users\Joel\Documents>dir /ad Volume in drive C has no label. Volume Serial Number is DE8B-53F2 Directory of C:\Users\Joel\Documents 02/07/2011 03:36 PM <DIR> . 02/07/2011 03:36 PM <DIR> .. 09/14/2010 05:56 AM <DIR> Archive 12/24/2010 07:24 PM <DIR> Misc 12/11/2009 06:42 AM <JUNCTION> My Music [C:\Users\Joel\Music] 12/11/2009 06:42 AM <JUNCTION> My Pictures [C:\Users\Joel\Pict +ures] 12/11/2009 06:42 AM <JUNCTION> My Videos [C:\Users\Joel\Videos +] 09/04/2010 05:52 AM <DIR> WORD 0 File(s) 0 bytes 25 Dir(s) 280,587,014,144 bytes free C:\Users\Joel\Documents>
    As for the clone, I had a WD drive going bad, got a new one under warranty (WD treated me right), and used their software "Acronis True Image" to clone it which copies sector by sector. I did have a number of unreadable sectors but am now booting off the new drive. It is difficult to know which files are on a particular sector and the clone log didn't list enough info anyway so I just wanted to see if there were any missing files before erasing the old drive and shipping it back.

    I just ran this code

    my $x = 'c:/users/joel/documents'; opendir(my $dh, $x) || die; while(readdir $dh) { if (-d "$x/$_") { print "dir $_\n";} if (-l "$x/$_") { print "lnk $_\n";} } closedir $dh;
    and get this:
    dir . dir .. dir Archive dir Misc dir My Music dir My Pictures dir My Videos dir WORD
    from above see that the "My x" are junctions (or links?) Shouldn't they get caught by the -d/-l test?

      You ought to be able to use Win32::Symlink to disambiguate junctions, but it fails to build as is, and if I 'fix' it, it fails its own tests.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.