Re: Counting & trashing
Re: Counting & trashing
- Subject: Re: Counting & trashing
- From: John Stewart <email@hidden>
- Date: Wed, 14 Jul 2004 08:57:14 -0400
On 07/14/04 at +0200 Bernard Azancot said this
>
=====
>
tell application "Finder"
>
set theList to every paragraph of (do shell script "ls -t " & POSIX
>
path of alias "IBM 01:Users:Parents:Desktop:Foo:")
>
end tell
>
=====
>
>
but the result stays empty
>
--> {""}
>
>
I must have missed something.
>
Any suggestion or other time sorting routines ?
>
>
Tanks in advance.
You needn't do any sorting to accomplish what you want. You just need to establish a cutoff date and trash everything older than
that date. Note: this script as written uses the creation date of folders more than 15 days old.
You may need to adjust "cutoff" to something other than 15 and you might want to hard code the value of targFolder instead of using
choose folder.
Apoligies for the line wrapping, this was posted in verbose mode due to this list's annoying habit of corrupting posted scripts.
(* Script Start *)
property cutoff : 15
set targDate to ((current date) - (cutoff * days))
set targFolder to choose folder
tell application "Finder"
set foldersOfTargFolder to every folder of targFolder
if (count of foldersOfTargFolder) is greater than cutoff then
delete (every folder of targFolder whose creation date is less than targDate)
end if
end tell
(* Script End *)
JBS
--
There are two major products that come out of Berkeley: LSD and UNIX. B We don't believe this to be a coincidence. B - Jeremy S.
Anderson
_______________________________________________
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.