Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

skunkworker

macrumors regular
Original poster
Sep 9, 2007
182
20
I have got a script that depends on scanning a folder's contents to see if it changes. I know that there is something in the 10.5 stuff with time machine that allows you to somehow do that. Does anybody know what the best way is?
 

larkost

macrumors 6502a
Oct 13, 2007
534
1
You really haven't told us much of what you want to do, so it is really hard to recommend something. The usual routes:

1) Keep a log of what was in there last time, and manually poll for changes. This is about the worst route.

2) Use launchd and a "KeepAlive" key for the watched path. This is probably the best route for a script... but depends on a number of things, and since you aren't sharing...

3) Use the fsevents api to watch the folder. This will get you great notifications, but requires callbacks, so is difficult to do in almost all scripting languages (technically possible in Python, but really difficult).

4) Use AppleScript "folder actions". I have never done this as they have a reputation of being flakey.
 

skunkworker

macrumors regular
Original poster
Sep 9, 2007
182
20
I've got a script that needs to see if a folder's contents have changed in any way and if so recompress images. Do any of these things allow a unix shell script to check somehow at different time intervals. Like right now and in an hour but not to make a daemon.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.