MonitorDirectory

Find quick help here to get you started with Hollywood
Post Reply
plouf
Posts: 470
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

MonitorDirectory

Post by plouf »

Hi

playing with MonitorDirectory, i notice that it will report changes in a directory AND its subdirectories, however table.directory name is always the initian one

if for example i monitor C:\test will report changes in C:test\subtest changes too
but table.directory will only tell "C:\test" in both cases
Is there a way to determine what has changed ?


also it does not allow for slah but backslash !

MonitorDirectory(1, "E:/Alarm/1")<- accept
MonitorDirectory(1, "E:\Alarm\1")<- Unknown sequence character after backslash!

do i miss something ?

test under Windwos7
Christos
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: MonitorDirectory

Post by jPV »

I don't know if OS itself reports either what's changed in the directory you monitor, so it might not be possible to get more detailed information. In these cases you should monitor each subdir themselves...

Of course it would be nice if it'd be possible to let us know what's changed, but if not, I would like to see a MonitorFile function too. I had to monitor datafile changes in RNOXfer's temp dir, and I ended up placing each data file in their own directory and monitor them that way. So, it would make things clearer if you could monitor individual files too. For example, the WaitForNotification shell command in MorphOS handles both directories and files.
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: MonitorDirectory

Post by airsoftsoftwair »

I can confirm that it indeed triggers for subdirectories on Windows... this shouldn't be the case. I'll have to examine.
plouf wrote: Wed Apr 08, 2020 12:07 am MonitorDirectory(1, "E:\Alarm\1")<- Unknown sequence character after backslash!
do i miss something ?
Yes, backslashes must be escaped, i.e.

Code: Select all

MonitorDirectory(1, "E:\\Alarm\\1")
Then it should work.
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: MonitorDirectory

Post by airsoftsoftwair »

Ok, so this isn't a bug. If you monitor the directory "test" and you change something in the directory "test/subdir", obviously the timestamp of the directory "subdir" changes which then triggers a change notification on "test". So this is perfectly right behaviour. You won't get a notification if you change anything two levels down the tree, i.e. monitor "test" and change something in "test/subdir/subdir". So all behaviour is completely correct here.
plouf
Posts: 470
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: MonitorDirectory

Post by plouf »

ok so, original question apply (it was orignilay a question :))
"is there a way to determine what has changed ?"

i understand that you could get a list of files and dates, when first start program, and then compare it every time.
But this may be extremely time/cpu consuming if drawers get bigger and bigger
Christos
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: MonitorDirectory

Post by airsoftsoftwair »

plouf wrote: Thu Apr 09, 2020 1:24 pm ok so, original question apply (it was orignilay a question :))
"is there a way to determine what has changed ?"
Currently not, but I agree that this would be a nice addition. I'll see what I can do.
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: MonitorDirectory

Post by airsoftsoftwair »

Code: Select all

- New [OS4/Windows]: MonitorDirectory() accepts a new "ReportChanges" tag now; if this is set to TRUE, your
  event callback will also be notified about what exactly has changed; there will be two new parameters:
  "Type" informing you about the type of change (add, remove, change) and "Name" will contain the name of
  the file or directory that has been changed; note that the "All" argument has no effect when setting
  "ReportChanges" to TRUE
Post Reply