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