1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Still problems understanding "foldermonitor"

Discussion in 'Support' started by Jang, Jun 9, 2011.

  1. Jang

    Joined:
    Jun 6, 2011
    Messages:
    7
    Likes Received:
    0
    Hi again,

    Still having problem understanding "foldermonitor" amongst other:

    1) When executing the bat file

    foldermonitor /s "C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes" modified created forever `set inbox_directory=%_foldername & set inbox_file=%_folderfile1 & Call "C:\Users\Gappe\Documents\TCC batfiles\Subtest.bat"`

    I get the following response when checking "foldermonitor" status:

    [C:\Program Files\JPSoft\TCMD12]foldermonitor
    No folders/files are being monitored

    but "Subtest.bat":
    echo %inbox_directory
    echo %inbox_file

    still produces result:
    [C:\Program Files\JPSoft\TCMD12]echo C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes
    C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes
    echo Jan\Getting Started.pdf
    Jan\Getting Started.pdf


    2) Any other suggestion than "Call" to execute a series of commands on a "foldermonitor" trigger event? Goto/Gosub apperently do not work in a Command Group. It seems I need to save values of %_foldername and %_folderfile1 or otherwise they will be lost after executing the command in "foldermonitor". Also I have not found any way to split the command group `set inbox_directory=%_foldername & set inbox_file=%_folderfile1 & Call "C:\Users\Gappe\Documents\TCC batfiles\Subtest.bat"`into several lines amongst other for easier readability.

    Apologies for lenghty explanation - new to this

    Kind regards and hoping for a solution
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,859
    Likes Received:
    83
    Not reproducible here. Is that the entire contents of your batch file? What happens if you put an empty FOLDERMONITOR command immediately following the first one?

    What version & build are you running?

    No, that's the only way to do it.

    Correct. (Not lost, but they will have the value of the last changed file. Otherwise, if you have hundreds or thousands of changes, you would never know which file you're getting.)

    Use a batch file!
     
  3. Jang

    Joined:
    Jun 6, 2011
    Messages:
    7
    Likes Received:
    0
    Hi and thanks for attending this matter,

    What version & build are you running?
    Upgraded to 12.10.67 - No change, same problem: "No folder or files being monitored"
    I mostly get expected results, however ocassionally I get strange non consistent results e.g. multiple rows of "echo on" without modified directory and file being listed, older CALL files being listed...and a crash.

    Not reproducible here. Is that the entire contents of your batch file? What happens if you put an empty FOLDERMONITOR command immediately following the first one?

    Yes is entire batch file:
    foldermonitor /s "C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes" foldermonitor modified created forever `set inbox_directory=%_foldername & set inbox_file=%_folderfile1 & Call "C:\Users\Gappe\Documents\TCC batfiles\Subtest.bat"`

    Subtest.bat:
    echo %inbox_directory
    echo %inbox_file

    Additional FOLDERMONITOR command result is:

    foldermonitor /s "C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes" foldermonitor m
    odified created forever `set inbox_directory=%_foldername & set inbox_file=%_folderfile1
    & Call "C:\Users\Gappe\Documents\TCC batfiles\Subtest.bat"`
    Foldermonitor
    C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes foldermonitor modified created
    (6/FOREVER) set inbox_directory=%_foldername & set inbox_file=%_folderfile1 & Call "C:
    \Users\Gappe\Documents\TCC batfiles\Subtest.bat"
    C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes foldermonitor modified created
    (2/FOREVER) set inbox_directory=%_foldername & set inbox_file=%_folderfile1 & Call "C:
    \Users\Gappe\Documents\TCC batfiles\Subtest.bat"
    C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes foldermonitor modified created
    (0/FOREVER) set inbox_directory=%_foldername & set inbox_file=%_folderfile1 & Call "C:
    \Users\Gappe\Documents\TCC batfiles\Subtest.bat"
     
  4. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,859
    Likes Received:
    83
    Why are you trying to nest a FOLDERMONITOR command inside another FOLDERMONITOR command? I can't think of any reason to do that, or any good that can come of it. (And you'll eventually exhaust TCC's stack memory and crash.)

    Remove the embedded "foldermonitor" and try it again:

    foldermonitor /s "C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes" modified created forever `set inbox_directory=%_foldername & set inbox_file=%_folderfile1 & Call "C:\Users\Gappe\Documents\TCC batfiles\Subtest.bat"`
     
  5. Jang

    Joined:
    Jun 6, 2011
    Messages:
    7
    Likes Received:
    0
    Major apologies - my bad. Was trying to figure out what you ment by adding another FOLDERMONITOR and by mistake copied you on a wrong version. It should have been the below (if I understood you correctly in "adding another Foldermonitor").


    foldermonitor /s "C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes" modified create
    d forever `set inbox_directory=%_foldername & set inbox_file=%_folderfile1 & Call "C:\Use
    rs\Gappe\Documents\TCC batfiles\Subtest.bat"`
    Foldermonitor
    C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes modified created (0/FOREVER)
    set inbox_directory=%_foldername & set inbox_file=%_folderfile1 & Call "C:\Users\Gappe\D
    ocuments\TCC batfiles\Subtest.bat"
    copy "C:\Users\Gappe\Documents\My Dropbox\Getting Started.pdf" "C:\Users\Gappe\Documents\
    My Dropbox\Test_local\Inboxes\Jan"
    C:\Users\Gappe\Documents\My Dropbox\Getting Started.pdf => C:\Users\Gappe\Documents\My Dr
    opbox\Test_local\Inboxes\Jan\Getting Started.pdf
    1 file copied
    echo C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes
    C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes
    echo Jan\Getting Started.pdf
    Jan\Getting Started.pdf
    [C:\Program Files\JPSoft\TCMD12]foldermonitor
    No folders/files are being monitored.
    [C:\Program Files\JPSoft\TCMD12]


    Trying to reset "FOLDERMONITOR /C and then running bat file again creates the following result:

    [C:\Program Files\JPSoft\TCMD12]
    [C:\Program Files\JPSoft\TCMD12]foldermonitor /c
    foldermonitor /s "C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes" modified create
    d forever `set inbox_directory=%_foldername & set inbox_file=%_folderfile1 & Call "C:\Use
    rs\Gappe\Documents\TCC batfiles\Subtest.bat"`
    Foldermonitor
    C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes modified created (1/FOREVER)
    set inbox_directory=%_foldername & set inbox_file=%_folderfile1 & Call "C:\Users\Gappe\D
    ocuments\TCC batfiles\Subtest.bat"
    C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes modified created (0/FOREVER)
    set inbox_directory=%_foldername & set inbox_file=%_folderfile1 & Call "C:\Users\Gappe\D
    ocuments\TCC batfiles\Subtest.bat"
     
  6. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,859
    Likes Received:
    83
    I don't know what you mean by this -- are you running that batch file
    multiple times without doing a FOLDERMONITOR /C before each invocation?
    (This would be a very, very bad idea -- FOLDERMONITOR will duly install a
    hook for the same directory tree over and over again.)

    I presume you haven't aliased FOLDERMONITOR to something else?

    Try to break it down to something much simpler than your example -- monitor
    one directory and have it do one thing (like an "echo %foldername
    %folderfile), and see it that works for you.
     
  7. Jang

    Joined:
    Jun 6, 2011
    Messages:
    7
    Likes Received:
    0
    Rex, your help is really appreciated.
    The bat file is very simple, setting variables for the folder and file being changed and then echoing them.
    Running a FOLDERMONITOR with only ECHO (as per your proposal) creates the same result, i.e. "No files/files being monitored".

    To clarify my previous reply - here is what is what I did step by step:

    1) Run the file (in IDE)
    ---------------------------------
    foldermonitor /s "C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes" modified create
    d forever `set inbox_directory=%_foldername & set inbox_file=%_folderfile1 & Call "C:\Use
    rs\Gappe\Documents\TCC batfiles\Subtest.bat"`
    Foldermonitor
    C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes modified created (0/FOREVER)
    set inbox_directory=%_foldername & set inbox_file=%_folderfile1 & Call "C:\Users\Gappe\D
    ocuments\TCC batfiles\Subtest.bat"
    copy "C:\Users\Gappe\Documents\My Dropbox\Getting Started.pdf" "C:\Users\Gappe\Documents\
    My Dropbox\Test_local\Inboxes\Jan"
    C:\Users\Gappe\Documents\My Dropbox\Getting Started.pdf => C:\Users\Gappe\Documents\My Dr
    opbox\Test_local\Inboxes\Jan\Getting Started.pdf
    1 file copied
    echo C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes
    C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes
    echo Jan\Getting Started.pdf
    Jan\Getting Started.pdf

    2) Check which folders/files being monitored
    --------------------------------------------------------
    [C:\Program Files\JPSoft\TCMD12]foldermonitor
    No folders/files are being monitored.
    [C:\Program Files\JPSoft\TCMD12]


    3) Reset FOLDERMONITOR (in spite of message above (2), stating no folder or files being monitored)
    -------------------------------------------
    [C:\Program Files\JPSoft\TCMD12]
    [C:\Program Files\JPSoft\TCMD12]foldermonitor /c

    4) Run bat file again (where it looks like two instances are inwoked)
    -----------------------------------------------------------------------------------
    foldermonitor /s "C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes" modified create
    d forever `set inbox_directory=%_foldername & set inbox_file=%_folderfile1 & Call "C:\Use
    rs\Gappe\Documents\TCC batfiles\Subtest.bat"`
    Foldermonitor
    C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes modified created (1/FOREVER)
    set inbox_directory=%_foldername & set inbox_file=%_folderfile1 & Call "C:\Users\Gappe\D
    ocuments\TCC batfiles\Subtest.bat"
    C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes modified created (0/FOREVER)
    set inbox_directory=%_foldername & set inbox_file=%_folderfile1 & Call "C:\Users\Gappe\D
    ocuments\TCC batfiles\Subtest.bat" <!-- / message -->
     
  8. Steve Pitts

    Joined:
    Jul 7, 2008
    Messages:
    159
    Likes Received:
    0
    Does it make any difference to your problems if you run all commands in the same TCC session?? My suspicion is that you are not running in the same context for both, and foldermonitor seems to be user specific, so if I issue a foldermonitor in a normal TCC, create a new elevated TCC (which in my case starts the new program as a different user with admin privileges) and issue the foldermonitor with no arguments then I see the same behaviour that you do.

    Equally issuing a foldermonitor /c in the elevated prompt has no effect on the foldermonitor from the original prompt, and not unexpectedly any actions in the elevated prompt that affect the monitored folders are reflected in the requested actions in the original prompt.
     
  9. Jang

    Joined:
    Jun 6, 2011
    Messages:
    7
    Likes Received:
    0
    Hi Steve and thank you! That explains - I tested and it seems to work the way you described. I was not aware of that (new to this).

    While I have all these skilled peoples attention, can I also ask how to split the foldermonitor command on multiple lines (rather than CALL a separate batch file). I have tried several versions (parentheses, strong quotes etc) but do not seem to get the command in `strong quotes`(echo only example multiple commands):

    foldermonitor /s "C:\Users\Gappe\Documents\My Dropbox\Test_local\inboxes" modified created forever `set inbox_directory=%_foldername & set inbox_file=%_folderfile1 & echo %inbox_directory & echo %inbox_file`

    to be interpreted as one commmand for FOLDERMONITOR if splitting in mulitple line e.g.:

    `set inbox_directory=%_foldername &
    set inbox_file=%_folderfile1 &
    echo %inbox_directory &
    echo %inbox_file`
     
  10. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,859
    Likes Received:
    83
    There is no way to do that other than a batch file or an alias.
     

Share This Page