Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

WatchDirectory is looping (with dropbox)

If you have a question or need help, this is the place to be.
Post Reply
jpboyrox
Posts: 4
Joined: Mon Feb 07, 2011 7:28 pm

WatchDirectory is looping (with dropbox)

Post by jpboyrox »

I am using the most recent version of Eventghost. It seems like great software and I have been using it for a while. I am trying to watch my dropbox folder and run a batch script when it notices any changes. I'm using time delays to give the actions time to process. It works fine when the changes are made locally, however, when dropbox has downloaded a new file, eventghost runs the script and then seems to loop, noticing the file and running the script. This is particularly annoying and is utterly useless. I thought that it must be the dropbox application. So I included in the eventghost commands to exit dropbox once the batch script had run. That worked, in that dropbox closed but eventghost kept seeing updates in the files so it kept on looping. I then tried creating a script which would kill eventghost and then start it up again after my original batch script had run. However, the new instance of evenghost still kept on recognising updates in the same file. This whole thing is very annoying as my batch script toggles a setting and it turning off and on repeatedly is winding me up
User avatar
zian
Site Admin
Posts: 569
Joined: Wed Jun 24, 2009 3:54 pm

Re: WatchDirectory is looping (with dropbox)

Post by zian »

How about you get Dropbox and that particular folder out of the equation?
sorta.

Could you make a batch file that does NOT involve EG that moves the file to a non Dropbox folder and then run your other batches from it using EG and directory watcher (non Dropbox = non looping)?

Could you set the EG directory watcher action (as you have it now) to...
Only run once? terminate itself? put a timer on it to disable/enable it after some time?

Or maybe not.
eventghost.net
Be there or be square.
jpboyrox
Posts: 4
Joined: Mon Feb 07, 2011 7:28 pm

Re: WatchDirectory is looping (with dropbox)

Post by jpboyrox »

I don't even think it is dropbox-related anymore. I think it is looping with all folders.
User avatar
zian
Site Admin
Posts: 569
Joined: Wed Jun 24, 2009 3:54 pm

Re: WatchDirectory is looping (with dropbox)

Post by zian »

I think the same thing is happening to me now.

Trying to use EG and the dir-watcher to move some .tp and smartskip chapter.xml files after the commercial detection has been completed. In the past I used comskip & dirmonitorII and it worked great. But changing stuff around now. Would like to do it all with as few programs as possible.

I tried to start a movefile.bat using directory watcher with "updated" it works but is forever looping. I switched it to run after "file deleted". A little better but still triggers too often for me. Does it hurt anything? I don't know.

I think I may just set it up somehow to just run the movefile.bat every hour or so.

It would be nice to have a little more control/options in the directory watcher.
eventghost.net
Be there or be square.
jpboyrox
Posts: 4
Joined: Mon Feb 07, 2011 7:28 pm

Re: WatchDirectory is looping (with dropbox)

Post by jpboyrox »

It's not just dropbox actually. Here is it looping three times when I am trying to sort my recorded TV Shows. I have set it up so I get emailed but, as it loops 3 times for each new show, I am getting loads of emails and it's annoying the hell out of me
Image
eatmeimadanish
Experienced User
Posts: 118
Joined: Thu Oct 01, 2009 5:11 pm

Re: WatchDirectory is looping (with dropbox)

Post by eatmeimadanish »

Maybe you should add a check to see if the file is in use before you take action in your script? Some VB code to do this:

Public Function FileInUse(ByVal sFile As String) As Boolean
If System.IO.File.Exists(sFile) Then
Try
Dim F As Short = FreeFile()
FileOpen(F, sFile, OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.LockReadWrite)
FileClose(F)
Catch
Return True
End Try
End If
End Function

You could create constraints to verify that the file is in use and disregard.
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: WatchDirectory is looping (with dropbox)

Post by Pako »

Ready-made solutions, see Directory Watcher topic.
Pako
Post Reply