Transfer SETI Units

This script keeps queued SETI units up to date (transferring up completed Units and downloading new packets). Used to fix problems with the current offline SETI apps. This will handle multiple CPU arrays.

OS version: OS X

tell application "Finder"
	set arrayfolders to {}
	set donelist to {}
	set command to {}
	set setifolder to folder "Applications:setiathome:SETIARRAY" of startup disk
	with timeout of 10 seconds
		set arrayfolders to the name of every folder of setifolder
	end timeout
	
	
	repeat with i from 1 to the count of arrayfolders
		if (exists file "result.sah" of folder (item i of arrayfolders) of setifolder) then
			set donelist to donelist & (item i of arrayfolders as string)
		end if
	end repeat
	
	if donelist is not {} then
		repeat with x from 1 to the count of donelist
			set command to "cd /Applications/setiathome/SETIARRAY/" & (item x of donelist as string) & ";" & "./setiathome -stop_after_xfer"
			display dialog "Transferring " & x & " of  " & (count of donelist) & ":" & (item x of donelist as string)
			do shell script command
		end repeat
	else
		display dialog "There are no completed units"
	end if
	
	if donelist is not {} then display dialog "File Transfers are complete."
end tell