in reply to Continuously polling multiple directories for file transfer?

What's "most efficient" usually somewhat depends on the context, so I'll refrain from making absolute statements here...  But generally, event based notification frameworks scale better than polling, i.e. in this case, when the number of files/directories gets large, the resources required to perform the same task will be less.

What's available in this respect depends on the OS you're using. For example, on Linux, there's inotify, for which exists the Perl binding Linux::Inotify2.

The basic idea is to register handlers that are being called by the notification system (via hooks in the kernel) when certain events happen, like file creation, etc.

  • Comment on Re: Continuously polling multiple directories for file transfer?

Replies are listed 'Best First'.
Re^2: Continuously polling multiple directories for file transfer?
by Corion (Patriarch) on Feb 10, 2009 at 12:46 UTC

    For Windows, there is Win32::ChangeNotify, which also can tell you about lots of changes happening in the file system. In theory, if you're using WMI, you should be able to listen (for example) to the __InstanceCreationEvent of CIM_DataFile, but a cursory search of the intertubes does only tell me of failures trying this.

Re^2: Continuously polling multiple directories for file transfer?
by Anonymous Monk on Feb 10, 2009 at 23:27 UTC
    The script will be run in Ubuntu in a VMWare virtual machine environment, so I will look into "inotify". Thank you all for the helpful comments!