O great monks,
How does one deal with files over a fileshare on a Win32 system? I need to do things like listing directories, determining files vs directories, copying/moving/deleting files, getting file dates, and the like. I've gotten reasonably proficient at this stuff on Unix systems by using Net::FTP, Net::Telnet, and/or the file test operators, but most of that doesn't apply here. The Win32 server(s) I'm dealing with aren't running FTP or Telnet daemons, and many of the standard file/directory functions seem to only work on local files/directories. For example:
$dir = "\\\\server\\share";
@files = <$dir/*>;
print "$_\n" for @files;
This returns nothing, presumably because the angle operator only works on local files. (Correct?)
$dir = "\\\\server\\share";
opendir DH, $dir or die "Cannot open $dir: $!";
@files = ( readdir DH );
print "$_\n" for @files;
This prints a directory listing, but the file test operators (-d, -M, etc.) can't be used to determine files from directories, timestamps, and such.
$dir = "\\\\server\\share";
@files = `dir $dir /b /a-d`;
print @files;
This works to list only the remote files, but please don't tell me I need to call DOS commands for this kind of stuff! If I want to copy/move/delete remote files, will I need to use external commands again?
There's clearly a huge Win32 hole in my Perl knowledge here. There must be modules to help with this, but I haven't found them. As always, I appreciate your advice/experience/gentle beatings in the right direction.
-E