Foldermonitor Bugs?

Jul 11, 2017
9
0
After entering in TCC

Foldermonitor C:\Users\tomwa\OneDrive\Yatu_xml /i"210704_test.txt" MODIFIED FOREVER (msgbox yesno "Copy" Copy all files to A:)

Foldermonitor command only works when "210704_test.txt" is modified. Other files in directory do not trigger the action. Action is triggered 3 times.

Typing foldermonitor in tcc command line does not show that the included file is "210704_test.txt"

After modifying file once foldermonitor shows 3/forever

Are these bugs? I only want action triggered once every time the file is modified.
 

Attachments

  • 210704_Foldermonitor.PNG
    210704_Foldermonitor.PNG
    14.5 KB · Views: 51
May 20, 2008
11,529
102
Syracuse, NY, USA
TCC is stuck with the way the (Microsoft) function ReadDirectoryChangesW works and it doesn't report modifications as one might expect. If the file exists, a clobbering redirection ( ... > 210704_test.txt) will cause TWO modifications to be reported.
 
Jul 11, 2017
9
0
Does this mean that foldermonitor won't work if I want to run just one batch file after a file is modified?
 
May 20, 2008
11,529
102
Syracuse, NY, USA
You might put a test of _FOLDERTIME in your command, or in the batch file. If you get two MODOFIEDs when you'd like only one, you can be confident they will have very very close times. Perhaps others will have better ideas.

Code:
v:\> foldermonitor v:\ /i"abc.def" modified forever echo %%_folderaction %%_foldertime

v:\> echo foo > abc.def

MODIFIED 20:46:55.228
v:\> MODIFIED 20:46:55.228
echo foo > abc.def
MODIFIED 20:46:57.925

v:\> MODIFIED 20:46:57.925
echo foo > abc.def

MODIFIED 20:47:02.782
v:\> MODIFIED 20:47:02.783
echo foo > abc.def

MODIFIED 20:47:04.890
v:\> MODIFIED 20:47:04.891
echo foo > abc.def

MODIFIED 20:47:07.949
v:\> MODIFIED 20:47:07.949
 
Jul 11, 2017
9
0
I get three folder monitor actions every time I edit a file.

Anyone else have an idea how to filemonitor so it only gives one notice per file modification?
 

Attachments

  • 210706_foldermonitor.PNG
    210706_foldermonitor.PNG
    3.8 KB · Views: 27
May 20, 2008
11,529
102
Syracuse, NY, USA
I'm pretty sure you can't. This page, ReadDirectoryChangesW function (winbase.h) - Win32 apps, shows the different changes an app can subscribe to (see the function's dwNotifyFilter parameter).

I have a slightly more elaborate version of FOLDERMONITOR (in a plugin) which I can mess around with. If I subscribe to FILE_NOTIFY_CHANGE_SIZE only, or to FILE_NOTIFY_CHANGE_LAST_WRITE only, or to both I get two notifications.

The notifications are pretty skimpy. You only get the file name and FILE_ACTION_MODIFIED, with no further indication of what actually happened.

I'm curious. In your pic, the first two notices are very close in time but the third is nearly a whole second later. Any idea how that happened?
 
Jul 11, 2017
9
0
No idea about why or how the timing shows up like that. All I did was ad a character to the file and saved.
 

Similar threads