I need to start work on a archiving script that in the end will contain a very lengthy set of steps…
The first step will entitle the searching of a server for any folders that have a date modified of current date - 120 days
This is just the beginning of a script that I will be using for arhiving purposes, and I was wondering if anyone has suggestions on how to do the date modified search, and return a list of the folder names that it locates…
the problem i see is that it may return a list old folders inside of old folders inside of old folders…etc
I only need the search to return the folders on a certain level of the directory and ignore the subsequent “old” olders inside of them
This is a modification of a script from this thread:
property retention : 120 * days
on run
open {choose folder}
end run
on open source_folder
set start_time to (current date)
set source_folder to item 1 of source_folder as alias
set cut_off to start_time - retention
tell application "Finder" to set the_folders to folders of source_folder
set folders_to_archive to {}
repeat with this_folder in the_folders
set this_folder to (this_folder as alias)
set the_info to (get info for this_folder)
if (modification date of the_info) < cut_off then set end of folders_to_archive to this_folder
end repeat
--do something with folders_to_archive
return folders_to_archive
end open