 
 <br><a href="localToTacc.cfm?action=checkchecksum">checkchecksum</a> - do this third, it checks that everything is happy
 
-<br><a href="localToTacc.cfm?action=cleanup_local">cleanup_local</a> - delete stuff
+<br><a href="localToTacc.cfm?action=cleanup_local">cleanup_local</a> - mark files where the local is confirmed delete
+	(and these can be deleted from the temp table; they're all done)
 
 
 <br><a href="localToTacc.cfm?action=showstatus">showstatus</a> - wut?

<br><a href="localToTacc.cfm?action=updateMedia">updateMedia</a> - I do hereby solemnly swear that nothing is jacked up, change real stuff


<br><a href="localToTacc.cfm?action=recoverDisk">recoverDisk</a> - DELETE local files


<cfsetting requesttimeout="300" />

<!---------------------------------------------------------------------------------------------------------->

<cfif action is "recoverDisk">

<cfoutput>
	<cfquery name="d" datasource="cf_dbuser">
		select * from cf_tacc_transfer
	</cfquery>
	<cfdump var=#d#>

	<cfabort>



	<!--- local files are loaded to /SpecimenImages or mediaUploads. Find stuff there that's not in media and delete it --->
	<cfdirectory action="LIST"
    	directory="#Application.webDirectory#/SpecimenImages"
        name="root"
		recurse="yes">
	<cfloop query="root">
		<cfif type is "file">
			<br>found #directory#/#name#
			<cfset webpath=replace(directory,application.webDirectory,application.serverRootUrl) & "/" & name>
			<br>webpath: #webpath#
			<cfquery name="isUsed" datasource="uam_god">

				<cfdirectory action="delete" directory="#directory#/#name#">
			</cfif>

---->

		</cfif>
	</cfloop>
</cftransaction>



</cfoutput>
</cfif>

<!---------------------------------------------------------------------------------------------------------->
<cfif action is "getDeleteScript">
<cfoutput>
	<cfquery name="d" datasource="cf_dbuser">
		select * from cf_tacc_transfer where status in ('remote_uri_confirmed;remote_tn_confirmed','remote_uri_confirmed')
		order by LOCAL_URI
	</cfquery>
	<cfloop query="d">
		<cfset localfPath=replace(LOCAL_URI,#application.serverRootUrl#,'#application.webDirectory#')>
		<br>rm -rf #localfPath#
		<cfif len(LOCAL_TN) gt 0>
			<cfset localfPath=replace(LOCAL_TN,#application.serverRootUrl#,'#application.webDirectory#')>
			<br>rm -rf #localfPath#
		</cfif>
	</cfloop>
	<hr>

	run the above, then

	<p>
		delete from cf_tacc_transfer where status in ('remote_uri_confirmed;remote_tn_confirmed','remote_uri_confirmed')
	</p>

</cfoutput>
</cfif>

<cfif action is "recoverDisk_confirmRemote">

<cfoutput>
	<cfquery name="d" datasource="cf_dbuser">
		select * from cf_tacc_transfer where status='media_updated'
	</cfquery>
	<cfloop query="d">
		<hr>
		<br>#REMOTE_URI#
		<cfset newstatus='recoverDisk_failed'>
		<cfif len(REMOTE_URI) is 0>
			<!--- wth this should never happen!! --->
			<cfset newstatus='REMOTE_URI_null_at_recoverdisk'>
		<cfelse>
			<cfhttp url="#REMOTE_URI#" method="HEAD" />
			<cfif left(cfhttp.statuscode,3) is "200">
				<cfset newstatus="remote_uri_confirmed">
			<cfelse>
				<cfset newstatus="remote_uri_missing">
			</cfif>
		</cfif>

		<br>#REMOTE_TN#
		<cfif len(REMOTE_TN) is 0>
			<!--- make sure there's not supposed to be one --->
			<cfif len(LOCAL_TN) gt 0>
				<cfset newstatus=listappend(newstatus,'remote_tn_notfound_but_localtn_exists',';')>
			</cfif>
		<cfelse>
			<!--- there is a remote thumb, make sure it's happy ---->
			<cfhttp url="#REMOTE_TN#" method="HEAD" />
			<cfif left(cfhttp.statuscode,3) is "200">
				<cfset newstatus=listappend(newstatus,'remote_tn_confirmed',';')>
			<cfelse>
				<cfset newstatus="remote_tn_missing">
			</cfif>
		</cfif>

		<cfquery name="uds" datasource="cf_dbuser">
			update cf_tacc_transfer set status='#newstatus#' where media_id=#media_id#
		</cfquery>



		<br>#newstatus#
	</cfloop>
</cfoutput>
</cfif>



<!---------------------------------------------------------------------------------------------------------->
<cfif action is "downloadLocalPath">
