Loading ...
Sorry, an error occurred while loading the content.
 

Re: UNC Problem in Perl Script

Expand Messages
  • Damien Carbery
    Try entering: hak-comproom D$ Temp in the Start/Run dialog. It should open an Explorer directory window. Of course you may not have the rights to access that
    Message 1 of 2 , Apr 2, 2001
      Try entering:
      \\hak-comproom\D$\Temp
      in the Start/Run dialog. It should open an Explorer directory window.
      Of course you may not have the rights to access that directory, which
      would definitely mean you can't access it in Perl.
      Does your opendir() call fail? If so, what is the error message
      provided by $! or $?.

      The Win32::NetResource module may allow you to connect to the
      directory as a drive and then delete the files.
      I searched the group archive for "NetResource" and found a few posts
      about using this module but none seem to say what definitely works.

      Have you tried your code in a command prompt?
      For example:
      del \\hak-comproom\D$\Temp\*.pif

      --- In perl-beginner@y..., "Christopher L. Severson" <cseverson@m...>
      wrote:
      > Everyone,
      >
      > Sorry for the what seems like constant questions - I am starting to
      get
      > frustrated around this.
      >
      > I am writing a program that gets a list of all NT Workstation
      accounts from
      > the PDC, and then will delete the contents of
      > C:\temp and D:\temp on each machine.
      >
      > Part of having to do this is either going to be using the 'unlink'
      command
      > or the 'opendir' command on a UNC path.
      > This is where I am running into troubles. Even if I go in to test
      and set
      > a variable up to a UNC path (which works, I can print the variable
      and see
      > it) I cannot then use that variable in my 'opendir' command. Here
      is what
      > I am trying:
      >
      > @filelist = ();
      > $path1 = "\\\\hak-comproom\\D\$\\Temp";
      >
      > opendir (Temp, "$path1") || die "Cannot open the temp directory:
      $!";
      > @filelist = readdir Temp;
      >
      > closedir (Temp);
      >
      > Everytime I run this part of the code, it cannot open the temp
      directory.
      > However if I just print the $path1 variable, it prints out just
      like it
      > should:
      >
      > \\hak-comproom\D$\temp
      >
      > Any help/insight to this problem would be greatly appreciated. I am
      using
      > ActiveState's Perl v.5.6.0 build 615.
      >
      > TIA!
      >
      > -Chris Severson
    Your message has been successfully submitted and would be delivered to recipients shortly.