flogic has asked for the wisdom of the Perl Monks concerning the following question:

I have a program which accesses samba shares via mapped drives on windows. I've set the drives to reconnect at start up. This worked fine for 2000. However XP seems to be lazy about reconnecting. So my program winds up failing because the drive mappig has not really connected yet. If I open the drive via explorer, it connects and then everything works fine. My target user is not going to like this. I was wondering if there was some way I could force XP to reconnect to the drive via Perl.

Replies are listed 'Best First'.
Re: Windows XP fun
by sweetblood (Prior) on Mar 04, 2005 at 17:50 UTC
    Without your code it makes it hard to really see what's up, but if you use the UNC rather than a mapped drive you won't need for windows to reconnect or connect at all for that matter. Try something like this.
    open DH, "\\\\machine\\share" or warn $!; my @dir_listing = readdir(DH); close DH;
    That will give you an array with the contents of the directory. You don't need to connect to "x:\\whatever" as long as you know the machine and share is called. Also, if you or someone should change the drive mapping it won't matter.

    Good Luck!

    Sweetblood

      I'll check that out as it's the simplest solution. My concern is that windows won't automagically poppup the username and password box. But I'll check it out.
Re: Windows XP fun
by ZlR (Chaplain) on Mar 04, 2005 at 16:13 UTC
      That just might be what I'm looking for.
Re: Windows XP fun
by Jenda (Abbot) on Mar 04, 2005 at 19:47 UTC

    Win32::FileOp? (19 Jul 2003? Hasn't been updated for so long? Either it's so perfect or I've been lazy lately. Probably the latter:)

    Jenda
    We'd like to help you learn to help yourself
    Look around you, all you see are sympathetic eyes
    Stroll around the grounds until you feel at home
       -- P. Simon in Mrs. Robinson