I have the following code to remove a directory recursively:

# 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; }
Running this code for some specific values always yields with Perl 5.8.8 something like:
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 ...
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, expected dev=2 inode=0, actu +al dev=-1 ino=0, 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)?

UPDATE

I found the error go away by doing a chdir first, i.e.
chdir($sharedir); rmtree($sharedir,1,1);
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:
RMDIR \\myhost.mycompany.com\results$\ART\fischron_st_st_buildlsf0.xml +_UID1235122965
-- 
Ronald Fischer <ynnor@mm.st>

In reply to File::Path::rmtree on UNC path (updated) by rovf

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.