AnsweredAssumed Answered

Applescript - get  filenames AND creation dates from a folder + filter by creation date

Question asked by Oliver_Reid on Oct 1, 2013
Latest reply on Oct 10, 2013 by sporobolus

This Applescript gets the file names from a folder and inserts them into a field:

 

(I am using the desktop folder as a test example)

 

tell application "Finder"

set oldDelimiters to AppleScript's text item delimiters

set AppleScript's text item delimiters to return

set gsourcefile to ""

try

set gsourcefile to every file in folder "/Thunderbolt/Users/oliver2/Desktop/" as text

end try

set AppleScript's text item delimiters to oldDelimiters

end tell

set cell "g_folder_items" to gsourcefile

 

 

I'd like to

 

1: get only file names from a folder where the creation date is less than N days old

 

2: return the fileneme & tab & creation date for each file

 

3: get file name alone -- the above returns the full path +filename (I can easliy fix this in filemaker but would like to know how to do this in Applescript)

 

 

with respect to #1 I have tried

 

try

set gsourcefile to (every file in folder "Thunderbolt:Users:oliver2:Desktop:" whose creation date is greater than ((current date) - 100)) as text

end try

 

with no success

 

Any suggestions would be appreciated

Outcomes