Re: Recursion script which doesn't?
Re: Recursion script which doesn't?
- Subject: Re: Recursion script which doesn't?
- From: Hugh Dixon <email@hidden>
- Date: Thu, 05 Apr 2001 14:30:22 +0000
On 4/4/01 2:23 pm, Nigel Garvey wrote
>
>
set lastrundate to date "Thursday, 14 December 2000 00:00:00"
>
set afolder to choose folder
>
comparefiles(afolder, lastrundate)
>
>
on comparefiles(afolder, lastrundate)
>
set thefilelist to {}
>
tell application "Finder"
>
set theFiles to (every file of afolder) as list
>
repeat with afile in theFiles
>
if modification date of afile comes after lastrundate then
>
set end of thefilelist to (contents of afile)
>
end if
>
end repeat
>
set theFolders to (every folder of afolder) as list
>
repeat with afolder in theFolders
>
my comparefiles(afolder, lastrundate)
>
set thefilelist to thefilelist & the result
>
end repeat
>
end tell
>
return thefilelist
>
end comparefiles
>
Look Mum, no Finder. Any use?
--Smile, OS8.6, AS 1.3.7 + Satimage
property lastrundate : date "Thursday, December 14, 2000 12:00:00 am"
property file_list : {}
set this_folder to (choose folder) as list
scan(this_folder)
return file_list
on scan(this_folder)
set folder_contents to list folder this_folder
set folder_path to this_folder as text
repeat with x from 1 to count folder_contents
--create a "pseudo" folder pathname for every item:
set trial_path to folder_path & item x of folder_contents & ":"
try --test the pathname to see if it really is a folder:
list folder trial_path
--it passed, so it's a folder which needs recursive scanning:
scan(trial_path as list)
on error --it failed, so it's a file which needs its date looking at
--Send the (incorrect) pathname to the date comparer:
is_it_new(trial_path)
end try
end repeat
end scan
on is_it_new(trial_path)
-- correct the pathname by removing the colon from the end
set this_pathname to (characters 1 thru -2 of trial_path) as text
set its_date to modification date of (info for this_pathname)
--(which coerces text to alias
--compare dates and write to list
if its_date > lastrundate then
set file_list to file_list & this_pathname
end if
end is_it_new
Hugh Dixon
Looking busy
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************