Re: Missing file date
Re: Missing file date
- Subject: Re: Missing file date
- From: Andrew Oliver <email@hidden>
- Date: Tue, 23 Sep 2003 13:42:23 -0700
As much as I'm a proponent of AppleScript over shell scripts, this is
something that really should be done in the shell:
do shell script "find /path/to/folder -mtime +18 -delete"
Making sure, of course, to properly escape/quote the folder path.
Andrew
:)
On 9/23/03 11:31 AM, "Timothy K. Wilkinson" <email@hidden> wrote:
>
I'm writing a script to go through my server's data drive and delete files
>
that are older then 18 days. Currently I'm just listing them but I hope to
>
have it delete them soon.
>
>
It works fine except for the times that there is no date. It returns a
>
value of "msng". This seems to happen on files that are invisible and have
>
a "." in front of them. I've tried to test for that (see below) but with
>
no success.
>
>
I'm using walk folders from Jon's Commands. I've set it to run without
>
invisibles but I'm getting hung up by the "." files.
>
>
Is there a way to skip over those "." files as well as the invisible ones?
>
>
Here's what I have so far (thanks to Jon for the example script):
>
>
--begin--
>
set theFiles to (choose folder)
>
>
script scour
>
property fileList : {}
>
>
on open (theFile)
>
set the_date to (current date)
>
tell application "Finder"
>
set file_date to the creation date of theFile
>
end tell
>
if file_date is not equal to "msng" then
>
set check_time to (the_date - file_date) / days
>
if check_time is greater than 18 then
>
copy theFile as string to end of fileList
>
end if
>
return fileList
>
end if
>
end open
>
end script
>
>
set old_list to walk folders theFiles with script scour without invisibles
>
display dialog (number of items of old_list) as string
>
>
>
--end---
>
>
Any thoughts or suggestions are greatly appreciated.
>
>
>
Tim Wilkinson
>
ITC-ACHS
>
University of Virginia
>
email@hidden
>
email@hidden
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.