Re: FindFile
Re: FindFile
- Subject: Re: FindFile
- From: "Marc K. Myers" <email@hidden>
- Date: Mon, 04 Dec 2000 14:08:23 -0500
- Organization: [very little]
Joe wrote:
>
Date: Mon, 04 Dec 2000 10:33:55 -0600
>
Subject: FindFile
>
From: Joe <email@hidden>
>
To: <email@hidden>
>
>
I'm trying to write a script that will find all files in a certain folder
>
that have creation dates that are older than 5 days before the current date.
>
>
I've tried writing the script using the FindFile addition but I keep getting
>
this errror " because *Ox//* the original item cannot be found 32768029"
>
>
Here is the script, can someone let me know what I'm doing wrong or if there
>
is a better way of doing this:
>
>
tell application "Finder"
>
set sourceFolder to choose folder with prompt "Select a folder to
>
search:"
>
set destFolder to choose folder
>
set ayearago to (current date) - 5 * days
>
>
set theList to FindFile in_folder sourceFolder date_modified_is_before
>
ayearago result_type "alis"
>
>
try
>
move (every item of theList) to destFolder
>
on error errtext number errnum
>
display dialog errtext & space & errnum
>
end try
>
end tell
I'm not familiar with the FindFile osax, but this script will do what
you want:
set srceFldr to (choose folder with prompt "Select source folder:")
set destFldr to (choose folder with prompt "Select destination folder:")
tell application "Finder" to set fileList to files of srceFldr
set cutOffDate to (current date) - (5 * days)
set moveList to {}
repeat with aFile in fileList
if modification date of (info for aFile) < cutOffDate then
set moveList to moveList & aFile
end if
end repeat
tell application "Finder" to move moveList to destFldr
Marc [12/4/00 2:07:12 PM]