Monitoring a Folder
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Monitoring a Folder
Hi,
I've got a folder with a few hundred (to a few thousand) text files in it.
Every 3-30 seconds a new text file will appear in it.
I'd like to know what the new file is (i.e. it's filename) so I can open run so tests on its contents.
Any suggestions as to what the most elegant way to tackle this is?
Thanks!
I've got a folder with a few hundred (to a few thousand) text files in it.
Every 3-30 seconds a new text file will appear in it.
I'd like to know what the new file is (i.e. it's filename) so I can open run so tests on its contents.
Any suggestions as to what the most elegant way to tackle this is?
Thanks!
Re: Monitoring a Folder
Hi.
It sounds like you need to run a handler that checks the contents of that folder regularly, and compare its contents from one pass to the next.
I think that you can only get a list of files in the current defaulrFolder. But you can always set the defaultFolder property to the folder you are interested in.
Craig Newman
It sounds like you need to run a handler that checks the contents of that folder regularly, and compare its contents from one pass to the next.
I think that you can only get a list of files in the current defaulrFolder. But you can always set the defaultFolder property to the folder you are interested in.
Craig Newman
Re: Monitoring a Folder
We're talking "the detailed files" here.
Simon
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Monitoring a Folder
Is the timing critical?
If you have a new file created every 3 to 30 seconds, would you be able to poll every (say) 20 seconds and check any new files periodically like that? Or must the first new file be dealt with before the next new file is saved in the folder?
If you have a new file created every 3 to 30 seconds, would you be able to poll every (say) 20 seconds and check any new files periodically like that? Or must the first new file be dealt with before the next new file is saved in the folder?
Re: Monitoring a Folder
HI, timing is pretty critical. I'd like to know within a second or two.
I'm trying to build a poker calculator for online play and some tracking software. It's been done before but it's a fun little project to work on while I do the Create It course.
So once a hand is finished a text file drops in a folder. A hand is finished about every 3-30 seconds.
I could keep the folders below a few hundred to speed it up. But it would be good to have the file picked up and examined within a second or less, so the information was ready quickly to be utilized while the next hand was playing.
Thanks!
I'm trying to build a poker calculator for online play and some tracking software. It's been done before but it's a fun little project to work on while I do the Create It course.
So once a hand is finished a text file drops in a folder. A hand is finished about every 3-30 seconds.
I could keep the folders below a few hundred to speed it up. But it would be good to have the file picked up and examined within a second or less, so the information was ready quickly to be utilized while the next hand was playing.
Thanks!
Re: Monitoring a Folder
Hi.
Do you know how to set up a recurring process in a handler that sends a message "in time"? Read up on the "send" command.
Craig
Do you know how to set up a recurring process in a handler that sends a message "in time"? Read up on the "send" command.
Craig
Re: Monitoring a Folder
Like a timer, then yes.
File names have a number on them, new files a higher number.
So build a recursive handler, each time it get a list off all the file names in a folder with a loop. Sort to find the highest number.
That make sense?
thanks!
File names have a number on them, new files a higher number.
So build a recursive handler, each time it get a list off all the file names in a folder with a loop. Sort to find the highest number.
That make sense?
thanks!
Re: Monitoring a Folder
Right on.
But make your timer using "send in time", as opposed to a repeat loop, so that you can still work.
Craig.
But make your timer using "send in time", as opposed to a repeat loop, so that you can still work.
Craig.
Re: Monitoring a Folder
Oops, yes, good advice!
Re: Monitoring a Folder
Nobaday,
I frequently create a folder called "Inbox" for this. That's where unprocessed files go. When I process them, I move them to another folder. That way I don't have very long lists of file names to search through or sort, especially if I need to frequently check for new files.
Walt
I frequently create a folder called "Inbox" for this. That's where unprocessed files go. When I process them, I move them to another folder. That way I don't have very long lists of file names to search through or sort, especially if I need to frequently check for new files.
Walt
Walt Brown
Omnis traductor traditor
Omnis traductor traditor
Re: Monitoring a Folder
that works, yes, I used to do similar with prepress processing of files (though with apple script). Good idea. could probably just have one file in the folder at any time....thx