• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Counting & trashing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Prev by Date: Re: Entourage 2004 'Script is trying attempt to send email"
  • Next by Date: Re: Counting & trashing
  • Previous by thread: Re: Counting & trashing
  • Next by thread: Re: Counting & trashing
  • Index(es):
    • Date
    • Thread