--Script written by Josh Elgin (http://www.onlyjoshing.com/) set pathToRecentItemsFolder to "Macintosh HD:Users:josh:Recent Items:" --insert the path to the folder you desire for your recent items set xDays to 3 --insert the number of days that the links should expire in remove_old(xDays, pathToRecentItemsFolder) create_links(get_list(), pathToRecentItemsFolder) --Gets the list of recent items and formats it for use on get_list() try set recent_items to do shell script "defaults read com.apple.recentitems docs | grep '\"'" end try set recent_itemsNoParen1 to replace_chars(recent_items, "(", "") set recent_itemsNoParen2 to replace_chars(recent_itemsNoParen1, ")", "") set recent_itemsNoQuotes to replace_chars(recent_itemsNoParen2, "\"", "") set recent_itemsNoReturns to replace_chars(recent_itemsNoQuotes, {ASCII character 13}, "") set recent_itemsSpaces to replace_chars(recent_itemsNoReturns, " ", "") set recent_itemsFormatted to trim_line(recent_itemsSpaces, " ", 2) set oldDelimiters to text item delimiters set my text item delimiters to "," set recent_itemsList to every text item of recent_itemsFormatted set my text item delimiters to oldDelimiters return recent_itemsList end get_list --Puts links to the files in the specified folder on create_links(item_list, recentItems_folder) repeat with counter from 1 to (number of items in item_list) set nextItem to item counter of item_list set nextItem_path to POSIX file nextItem tell application "Finder" if file nextItem_path exists then --Make sure the original item is still there if (file (recentItems_folder & (name of file nextItem_path)) exists) = false then --Make sure the link does not already exist make new alias file to nextItem_path at alias recentItems_folder with properties {name:name of file nextItem_path} end if end if end tell end repeat end create_links --Removes links that are days old on remove_old(how_old, recentItems_folder) tell application "Finder" try set aliasList to (every file of folder recentItems_folder) end try repeat with counter3 from 1 to (number of items in aliasList) if (modification date of (item counter3 of aliasList)) < ((current date) - how_old * days) then move (item counter3 of aliasList) to trash end if end repeat end tell end remove_old --Got the following from Apple (http://www.apple.com/applescript/guidebook/sbrt/pgs/sbrt.07.htm) on replace_chars(this_text, search_string, replacement_string) set AppleScript's text item delimiters to the search_string set the item_list to every text item of this_text set AppleScript's text item delimiters to the replacement_string set this_text to the item_list as string set AppleScript's text item delimiters to "" return this_text end replace_chars on trim_line(this_text, trim_chars, trim_indicator) set my text item delimiters to "" -- 0 = beginning, 1 = end, 2 = both set x to the length of the trim_chars -- TRIM BEGINNING if the trim_indicator is in {0, 2} then repeat while this_text begins with the trim_chars try set this_text to characters (x + 1) thru -1 of this_text as string on error -- the text contains nothing but the trim characters return "" end try end repeat end if -- TRIM ENDING if the trim_indicator is in {1, 2} then repeat while this_text ends with the trim_chars try set this_text to characters 1 thru -(x + 1) of this_text as string on error -- the text contains nothing but the trim characters return "" end try end repeat end if return this_text end trim_line