# Looking for entries in \\myhost.mycompany.com\results$\ matching a certain glob pattern
my @sharedirs=glob("//myhost.mycompany.com/results\$/ART/$username*$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;
}
####
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 ...
####
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, actual dev=-1 ino=0, aborting at ...
####
chdir($sharedir); rmtree($sharedir,1,1);
####
RMDIR \\myhost.mycompany.com\results$\ART\fischron_st_st_buildlsf0.xml_UID1235122965