Foldermonitor with "/E" Option Issue

Dec 2, 2008
226
2
Canada
If I run the following:

FolderMonitor /C
FolderMonitor /S c:\ /E"JPSoft\Logs\Errors.log" MODIFIED 1 c:\JPSoft\Startup\A.btm 1
FolderMonitor /S c:\ MODIFIED 1 c:\JPSoft\Startup\A.btm 2​

And if both A.btm is:

@echo Start Action %1
@echo %_foldercount
@echo %_foldername
@echo %_folderfile1
@echo Done Action %1​

I get the following:

1
c:\
JPSoft\Logs\Commands.txt
Done Action 2​

The "FolderMonitor /S c:\ MODIFIED 1 c:\JPSoft\Startup\A.btm 2" command fired but the "FolderMonitor /S c:\ /E"JPSoft\Logs\Errors.log" MODIFIED 1 c:\JPSoft\Startup\A.btm 1" command didn't fire but should have fired. It was "JPSoft\Logs\Commands.txt" that caused the monitors to fire and not "JPSoft\Logs\Errors.log", so both FolderMonitor commands should have fired. So far it appears that the "/E" option disables FolderMonitor, I have not been able to get anything to fire when using a "/E" option.

Any Ideas?
 
Dec 2, 2008
226
2
Canada
One other thing that I noticed, if you put another FolderMonitor statement into the command statement of another FolderMonitor statement, as soon as the second FolderMonitor's condition is meet TCC crashes.

For example:

FolderMonitor /S c:\ MODIFIED 1 c:\JPSoft\Startup\A.btm 2
And A.btm contains:

REM Restart Monitor command after doing something
:
Do something
:
FolderMonitor /S c:\ MODIFIED 1 c:\JPSoft\Startup\A.btm 2​

As soon as a file gets modified a second time, the FolderMonitor from the A.btm crashes TCC.
 

rconn

Administrator
Staff member
May 14, 2008
12,369
150
One other thing that I noticed, if you put another FolderMonitor statement into the command statement of another FolderMonitor statement, as soon as the second FolderMonitor's condition is meet TCC crashes.

Why on earth would you want to do that??

The crash is in Windows code, so there's probably not much I could do about it other than forcibly prohibiting the action.
 
Dec 2, 2008
226
2
Canada
Because the “/W” doesn't work like I thought it would and “/E” doesn’t seem to work. If I set “n” (Number of repetitions) to 1, I only have to deal with the first occurrence, I don’t want to deal with all the others that may come after it. After processing the event, I may want to start monitoring the folder again.

I only want one event inside a critical section of the foldermonitor event handler. Semaphores maybe helpful to handle critical section of a batch script for the event handler, maybe something for version 20?
 

rconn

Administrator
Staff member
May 14, 2008
12,369
150
If I run the following:

FolderMonitor /C
FolderMonitor /S c:\ /E"JPSoft\Logs\Errors.log" MODIFIED 1 c:\JPSoft\Startup\A.btm 1
FolderMonitor /S c:\ MODIFIED 1 c:\JPSoft\Startup\A.btm 2​

And if both A.btm is:

@echo Start Action %1
@echo %_foldercount
@echo %_foldername
@echo %_folderfile1
@echo Done Action %1​

I get the following:

1
c:\
JPSoft\Logs\Commands.txt
Done Action 2​

The "FolderMonitor /S c:\ MODIFIED 1 c:\JPSoft\Startup\A.btm 2" command fired but the "FolderMonitor /S c:\ /E"JPSoft\Logs\Errors.log" MODIFIED 1 c:\JPSoft\Startup\A.btm 1" command didn't fire but should have fired. It was "JPSoft\Logs\Commands.txt" that caused the monitors to fire and not "JPSoft\Logs\Errors.log", so both FolderMonitor commands should have fired. So far it appears that the "/E" option disables FolderMonitor, I have not been able to get anything to fire when using a "/E" option.

Any Ideas?

Unless you've got a few terabytes of RAID 0 SSDs, I wouldn't recommend doing a "FOLDERMONITOR /S C:\"! Windows can write upwards of several thousand times a second to C: (for things like the page file).

The documentation for FOLDERMONITOR /E is slightly off. After some thought I decided to tweak the code so it would (also) support the syntax described in the docs; it will be in the next build.
 
Dec 2, 2008
226
2
Canada
Actual I was only using FolderMonitor /S C:\ for testing, I was only using "1" to "10" for repeats and never FOREVER. I was trying to workout how to handle a critical section within the event handler of the FolderMonitor. Using "1" for the repeat is one way of handling it but then you run into the problem of having to restart the FolderMonitor.
 

rconn

Administrator
Staff member
May 14, 2008
12,369
150
One other thing that I noticed, if you put another FolderMonitor statement into the command statement of another FolderMonitor statement, as soon as the second FolderMonitor's condition is meet TCC crashes.

For example:

FolderMonitor /S c:\ MODIFIED 1 c:\JPSoft\Startup\A.btm 2
And A.btm contains:

REM Restart Monitor command after doing something
:
Do something
:
FolderMonitor /S c:\ MODIFIED 1 c:\JPSoft\Startup\A.btm 2​

As soon as a file gets modified a second time, the FolderMonitor from the A.btm crashes TCC.

The problem here is that you are *still* inside the first FOLDERMONITOR call when "A.btm" is executed, so what you're doing is creating an infinite loop of FOLDERMONITOR calls, until TCC runs out of memory or resources.
 
Similar threads
Thread starter Title Forum Replies Date
cgunhouse Foldermonitor with /W option Support 10
twaterloo Foldermonitor Bugs? Support 6
twaterloo FolderMonitor for the 1st time not working Support 5
vefatica FOLDERMONITOR: /= dialog creates malformed command Support 2
cgunhouse Foldermonitor Issue Support 7
C FOLDERMONITOR inactive with multiple /I Support 1
G FOLDERMONITOR created also firing for delete (and maybe other events) Support 7
vefatica Fixed FOLDERMONITOR causes crash Support 23
mikea FOLDERMONITOR confusions Support 7
cgunhouse Foldermonitor and iftp Support 1
T How to? Using FOLDERMONITOR 1 event causes multiple trigger(ing)s Support 8
Frank question to FOLDERMONITOR Support 14
S Log and foldermonitor problems Support 3
Steve Pitts FOLDERMONITOR missing events?? Support 7
J Still problems understanding "foldermonitor" Support 9
D Fixed TCMD /X option Support 7
Jay Sage WAD Possible Bug With OPTION Command With @FILE Support 5
Jay Sage WAD Failure of Alias Command with /Z Option Support 14
D Purpose of DIRHISTORY /N option Support 2
Peter Murschall OPTION //directive=value is a ENDLOCAL Support 3
Charles Dye Does HASH's /E option do anything? Support 1
Charles Dye ASSOCIATE loses /P option Support 4
A Documentation [Help file] OPTION "//" synopsis formatting issue Support 0
thorntonpg option /u not working The directory name is invalid Support 5
rps TCMD Tabs priority option setting Support 0
A How to? TCMD Configuration Dialog: 'Smooth Scrolling' Option missing? Support 1
A Fixed (CMD compat) START /D fails to recognize the switch option. Support 3
R Fixed 7ZIP Compression Method Option Doesn't Work Support 1
D everything /o does not open the option dialog Support 4
fishman@panix.com How do I make the selections in the option menu sticky? Support 23
vefatica OPTION /U Support 2
Alpengreis TCC-Option for EnableDelayedExpansion (!var!) problem Support 15
D The BatchEcho option Support 8
D /extract: option for the installer Support 4
fishman@panix.com Why are the OPTION settings not sticky??? Support 11
vefatica OPTION /U Support 1
vefatica TPIPE's /perl option? Support 1
I TC "Registering" but NOT Registering, Now Hung on TCMD Option Screen Support 2
cgunhouse IFTP "/S" Option Support 6
Alpengreis [TC 17.x] Install with "option /u" failed Support 5
cgunhouse Jabber Command Line Option Being Transmitted -- Fixed with Build 42 Support 2
Charles Dye OPTION dialog appears underneath Take Command window Support 4
Charles Dye OPTION /U, private beta to public Support 4
Alpengreis WAD Command "MSGBOX /?" does not show option /N Support 2
Phileosophos Fixed Option Dialog Hangs when Using Help Support 7
M Web Help option in Take Command 15 broken? Support 3
fpefpe How to? start command /tab option/switch Support 6
S How to? Find installer downloaded by "option /u"? Support 11
W /g option (%) on MOVE cmd appears broken TCC 14.03.57 x64 Support 8
Charles Dye Odd behavior after using OPTION "Advanced" tab Support 2

Similar threads