Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Windows has invisible shares called C$, D$, etc representing C:, D:, etc.

If the machine you wish to poll has file sharing enabled,
if the machine on which the program runs is a Win32 machine with "Client for Microsoft Networks" enabled, and
if your login and password is the same for that machine as it is for the current machine,
then you can just open \\machine\c$\some\dir (or //machine/c$/some/dir if it's easier) using opendir. Win32::ChangeNotify will also accepts such a path.

use strict; use warnings; my $path = '\\\\godzilla\\c$\\temp'; for (;;) { my $count = () = do { opendir my $dh, $path or die; readdir($dh) }; print("$count\n"); sleep(2); }
2 2 2 2 3 3 3 4 Terminating on signal SIGINT(2)
use strict; use warnings; use Win32::ChangeNotify qw( FILE_NOTIFY_CHANGE_DIR_NAME FILE_NOTIFY_CHANGE_FILE_NAME ); my $path = '\\\\godzilla\\c$\\temp'; for (;;) { my $count = () = do { opendir my $dh, $path or die; readdir($dh) }; print("$count\n"); my $notify = Win32::ChangeNotify->new($path, 0, FILE_NOTIFY_CHANGE_ +DIR_NAME|FILE_NOTIFY_CHANGE_FILE_NAME); $notify->wait or die; }
2 3 4 Terminating on signal SIGINT(2)

Update: Added code.

In reply to Re: Connecting to network shared drive by ikegami
in thread Connecting to network shared drive by murtu_4u

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2021-10-19 23:51 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (78 votes). Check out past polls.