Got on for you all!
Cliff Nowack
cliff at thenowacks.com
Tue Feb 12 09:52:56 CST 2008
One way would be to wrap the delete in a try, then it wouldn't error.
set the_folder_path to alias "PDFProofs:"
set days_old to 8
set this_date to current date
set weeks_old_in_seconds to days_old * days
set too_old_date to this_date - weeks_old_in_seconds
tell application "Finder"
activate
tell (every file of folder the_folder_path whose creation date comes
before too_old_date)
try
delete
end try
end tell
end tell
or you could also do this, which will only attempt to delete if it
finds old files.
set the_folder_path to alias "PDFProofs:"
set days_old to 8
set this_date to current date
set weeks_old_in_seconds to days_old * days
set too_old_date to this_date - weeks_old_in_seconds
tell application "Finder"
activate
set fileList to (every file of folder the_folder_path whose creation
date comes before too_old_date)
repeat with i from 1 to count of fileList
set thisFile to item i of fileList
delete thisFile
end repeat
end tell
Don't know about the postscript problem.
Cliff
On Feb 12, 2008, at 7:11 AM, Zach Manring wrote:
> set the_folder_path to alias "PDFProofs:"
> set days_old to 8
>
> set this_date to current date
> set weeks_old_in_seconds to days_old * days
> set too_old_date to this_date - weeks_old_in_seconds
>
> tell application "Finder"
> activate
> tell (every file of folder the_folder_path whose creation date
> comes
> before too_old_date)
> delete
> end tell
> end tell
More information about the Creator
mailing list