Re: monitor a folder for file creation, how?



fanbanlo <henryho@xxxxxxxxxxxxxxxxxxxx> writes:

> How do I monitor a folder for new file(s) creation?
> How to use thread to do a wait until a new file is 'detected'?

There's not a clean portable way to do this.

The portable way is to poll the update time of the folder at regular
intervals, and act when it changes. I did that for a Maildir mail
monitoring tool once, but can't seem to find the source now. Sorry.

The clean way depends on your platform. Most modern system have a
mechanism to get the kernel to notify you when a file/directory is
updated. But they are all different. Since you say "folder", I assume
you're on Windows - and I can't help you with this one.

<mike
--
Mike Meyer <mwm@xxxxxxxxx> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
.



Relevant Pages

  • Re: workaround for FCN/directory delete bug
    ... complicated because the browser requests chunks of the file with separate ... PropertyInfo p = ... object monitor = f.GetValue; ... files in the app_data folder are not served ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Cannot install new printer drivers
    ... Permissions in the folder you asked about are covered in the ... I downloaded and ran Process Monitor (which supersedes File Monitor and ... The built-in Administrator account may behave differently than one you added ... Registry Monitor from Sysinternals to produce a log of file or registry ...
    (microsoft.public.windowsxp.print_fax)
  • Re: MS Fax basic send failure
    ... There's no tools>options on the fax console. ... entry pending in the fax console's outbox folder. ... Select tools, and choose fax monitor. ...
    (microsoft.public.windowsxp.print_fax)
  • Re: several media player problems or questions
    ... monitor my media folder, which is where the books download to. ... player doesn't monitor that folder. ... track ones from however many discs there are, and then all track 2's, etc. ...
    (microsoft.public.windowsmedia.player)
  • Re: Turning off file monitoring in WMP11
    ... I don't think you can remove your rip folder from the monitored list. ... Add the music by either dragging and dropping the folder over your library or setting WMP to monitor long enough to get the music added originally then remove the folder from the list. ... You'll have to use the drag and drop method to add any new music files. ...
    (microsoft.public.windowsmedia.player)