on adding folder items to this_folder after receiving added_items try -- Size limit of the Trash folder in MB set trash_limit to 2048 -- Touch all incoming items to update the modified date to now repeat with i from 1 to the count of added_items set a_file to item i of added_items set sh_script to "touch " & quote & (POSIX path of a_file) & quote do shell script sh_script end repeat -- Get the current Trash size in clusters, then divide by 2048 to get megabytes set trash_size to do shell script "du -s ~/.Trash/ | awk '{print $1}'" set trash_size to trash_size / 2048 -- Delete old items until we're under the limit repeat while trash_size is greater than trash_limit set trash_files to (list folder this_folder without invisibles) set oldest_file to {} -- Get the least recently deleted file in the Trash folder repeat with i from 1 to the count of trash_files set a_file to alias ((this_folder as text) & (item i of trash_files)) if i is equal to 1 then set oldest_file to a_file if the (modification date of (info for a_file)) comes before (modification date of (info for oldest_file)) then set oldest_file to a_file end repeat -- Delete the file and update the Trash icon set sh_script to "rm " & quote & (POSIX path of oldest_file) & quote do shell script sh_script tell application "Finder" to update trash -- And rinse! set trash_size to do shell script "du -s ~/.Trash/ | awk '{print $1}'" set trash_size to trash_size / 2048 end repeat end try end adding folder items to