Re: Counting & trashing
Re: Counting & trashing
- Subject: Re: Counting & trashing
- From: Nigel Garvey <email@hidden>
- Date: Wed, 14 Jul 2004 14:54:13 +0100
Bernard Azancot wrote on Tue, 13 Jul 2004 11:16:16 +0200:
>
I am trying to write a script that performs the following tasks:
>
>
1 - count the folders in a container backup folder
>
2 - if the total number of folders is > 15, select & delete the
>
exceeding older folders .
>
>
For my information, I would like to know what this script could become
>
if I want to do the same thing using now a time criteria:
>
- select folders whose creation date is < today's date minus 15 days,
>
an delet them.
A time criterion script would be pretty much what you've written to
describe it! But you'd have to be clear whether you meant the cut-off to
be "15 * 24 hours before this moment" or "the date fifteen days ago".
set theFolder to (choose folder)
set cutoffDate to (current date) - 15 * days
-- Make the cutoff time midnight 15 days ago
set time of cutoffDate to 0
tell application "Finder" to delete (every folder of theFolder whose
modification date comes before cutoffDate)
NG
_______________________________________________
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.