How would you explore and write to windows shared directories in perl ? Note: I don't have the right for network drive creation on the concerned workstation. I tried (without results) the following :
my $ROOTDIR1 = 'c:/';
my $ROOTDIR2 = '//server/dir1/dir2/';
sub dtest {
my $ROOTDIR = shift;
warn "Testing '$ROOTDIR'.";
opendir( SHAREFILE, "$ROOTDIR" ) or warn "1 -> " . $!;
my @files = <$ROOTDIR*>;
warn ("2 -> nothing !") if (!scalar @files);
chdir $ROOTDIR or warn "3 -> " . $!;
}
dtest($ROOTDIR1);
dtest($ROOTDIR2);
But as shown by the following output :
Testing 'c:/'. at E:\test\a.pl line 5.
Testing '//server/dir1/dir2/'. at E:\test\a.pl line 5.
1 -> No such file or directory at E:\test\a.pl line 6.
2 -> nothing ! at E:\test\a.pl line 8.
3 -> No such file or directory at E:\test\a.pl line 9.
None of those methods are working.
Any idea ?