How do you scan a folder for newly added files using applescript.
I am trying to identify the newest files (picture formats) within a folder, from the previous time it has been inspected.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If I understand your question correctly, you want some script which, when you run it, will give you all files that are “new.” Where “new” means the script has not seen them previously.
So if you run the script on a directory with files a.txt, b.txt, and c.txt, you would get all 3 of those files back from the script. Then before you run it again, files d.txt and e.txt are added, then you run your script, you should get both d.txt and e.txt.
In order to accomplish this you will need to store some information between runs of the script. For example you might create a hidden file .lastFileISaw and store in it the last filename or its timestamp. Then your applescript cna check for this file, if it’s not there, return all files in the dir, if it is there return only those more recent than the contents of your hidden file.
I think services like Dropbox and SparkleShare utilize DTrace on OSX to accomplish these kinds of things.