Your best friend for file transfer.

Fetch application logoFetch

File Selection based on modification date (3 posts)

This is an archived topic. The information in it is likely to be out-of-date and no longer applicable to current versions of Fetch.
  • Started 15 years ago by freyj
  • Latest reply 15 years ago from freyj
  • freyj Member

    Hi Jim,

    I'm trying to use AppleScript to delete files older than a week old. So far I can grab a list of the filenames or a list of the modification dates. I just can't get a list of the names of the items I want to delete.

    How do I get "set file_list to get name of every remote file whose whose modification date is less than (the current date) - (7 * days)" to work? What am I missing?

    Thanks,

    Jim

    ------------------------------

    Jim Frey
    IT Integration Engineer
    RR Donnelley & Sons
    Lancaster Financial

    Posted 15 years ago #

  • Jim Matthews Administrator

    Unfortunately Fetch does not support AppleScript "whose" clauses. So you would have to do check the dates of the files one by one, using code like this:

    set fnames to name of every remote item
    set newfnames to {}
    repeat with aname in fnames
    set aname to aname as string
    if (modification date of remote item aname > date "Saturday, June 1, 2002 12:00:00 AM") and ¬
    (item type of remote item aname is isFile) then
    set newfnames to newfnames & aname
    end if
    end repeat

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 15 years ago #

  • freyj Member

    That's just what I needed!

    Thanks Jim.

    Jim

    Posted 15 years ago #

Topic closed

This topic has been closed.