: So basically what happens when my script runs is it makes folders
: with the date and time. I include the time so that people can
: make multiple backups in one day with out error. Anyway here
: is the folder name: 02_15_2002.36318_docs
I’m not getting the time stamp part (5 digits?) so I ignored it. As a result, you should probably add a day to the first script below. You don’t say whether the folder’s date created or modified is reliable (i.e., if it matches the time stamp.) If so, the second script below would be better. Note that both need the function all the way at the end.
– This one parses name:
tell application "Finder"
set folderName to name of selection
-- parse name
set {oldTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, {"_"}}
set folderDate to text items 1 thru 3 of folderName
set AppleScript's text item delimiters to "/"
set folderDate to folderDate as text
set AppleScript's text item delimiters to "."
set folderDate to text item 1 of folderDate
set AppleScript's text item delimiters to oldTID
-- ends up in "mm/dd/yyyy" format
-- your date and time prefs should match this
if (findOutIfItsOld(folderDate) of me is true) then -- it's old
beep 3
end if
end tell
-- OR, if the creation date or modification date is a reliable indicator, use this one:
tell application "Finder"
set folderDate to creation date of selection
if (findOutIfItsOld(folderDate) of me is true) then -- it's old
beep 3
end if
end tell
-- Either needs this function:
to findOutIfItsOld(someDate)
set someDate to (date the someDate)
if (((date someDate) + (2 * days)) < (current date)) then -- it's 2 days old
return true
else
return false
end if
end findOutIfItsOld
–tet