rovf has asked for the wisdom of the Perl Monks concerning the following question:
Running this code for some specific values always yields with Perl 5.8.8 something like:# Looking for entries in \\myhost.mycompany.com\results$\ matching + a certain glob pattern my @sharedirs=glob("//myhost.mycompany.com/results\$/ART/$use +rname*$uidstr"); if(@sharedirs==0) { print "No result share found\n"; } elsif(@sharedirs > 1) { print("No unique result share found\n", } else { my $sharedir=$sharedirs[0]; print "Removing $sharedir\n"; print "Removing of $sharedir was not successful\n" if rmtree +($sharedir,1,1)==0; }
Perl 5.10 gives a little bit more information:Removing //myhost.mycompany.com/results$/ART/fischron_st_st_buildlsf0. +xml_UID1235122965 Directory //myhost.mycompany.com/results$/ART/fischron_st_st_buildlsf0 +.xml_UID1235122965 changed before chdir, aborting at ...
I don't know what the device numbers mean in a Windows environment, but any idea how I could solve the problem (lest of writing my own rmtree code)?Removing //myhost.mycompany.com/results$/ART/fischron_st_st_buildlsf0. +xml_UID1235122965 Directory //myhost.mycompany.com/results$/ART/fischron_st_st_buildlsf0 +.xml_UID1235122965 changed before chdir, expected dev=2 inode=0, actu +al dev=-1 ino=0, aborting at ...
UPDATE
I found the error go away by doing a chdir first, i.e.Now it works a lot better, BUT although rmtree can remove all the files within $sharedir, it complains "Permission denied" on $sharedir itself (and also unlink $sharedir can't erase it. Well, you might say, this just means that $sharedir is read-only. But the funny thing is that I can easily remove the directory from the command line:chdir($sharedir); rmtree($sharedir,1,1);
RMDIR \\myhost.mycompany.com\results$\ART\fischron_st_st_buildlsf0.xml +_UID1235122965
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File::Path::rmtree on UNC path (updated)
by Anonymous Monk on Mar 04, 2009 at 12:54 UTC | |
by rovf (Priest) on Mar 04, 2009 at 13:25 UTC | |
by swhl (Initiate) on Jun 10, 2009 at 10:01 UTC | |
by rovf (Priest) on Jun 10, 2009 at 11:40 UTC |