Emptying the downloads Folder when it reaches a certain size

Can anyone assit in a script that moves items to the trash after the folder reaches a certain size or on a schedule.
I was able to do make a workflow but scheduling it seems difficult without 3rd part tools.

I came across a script that empties the Trash bin after a certain size and that isusing folder actions to kick it off.

Any help would be apreciated.

To give some background we use Sharepoint and on Macs every item you open gets downloaded first then opens.
My plan would be to move it to trash and empty the trash every when it reaches a certain size.

Any ideas would be great.

thAanks

themush

This will delete all but the most recently added files. Set Max_size to your liking.

on adding folder items to this_folder after receiving added_items
	set Max_size to 55
	tell application "Finder"
		set file_list_size to (size of this_folder) / (1024 ^ 2)
		if file_list_size > Max_size then
			set file_list to every item in this_folder as alias list
			repeat with each_file in file_list
				try
					if each_file is not in added_items then
						delete each_file
					end if
				on error err
					display dialog err
				end try
			end repeat
		end if
	end tell
end adding folder items to