 				<cfdirectory action="delete" directory="#directory#/#name#">
 			</cfif>
 
+---->
 
 		</cfif>
 	</cfloop>
-
-	<cfdirectory action="LIST"
-    	directory="#Application.webDirectory#/mediaUploads"
-        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">
-				select media_id from media where
-					(
-						media_uri='#webpath#' or
-						preview_uri='#webpath#'
-					)
-			</cfquery>
-			<br>isUsed.recordcount: #isUsed.recordcount#
-			<cfif isUsed.recordcount is 0>
-				<br>going to delete
-				<cfif (dateCompare(dateAdd("d",7,datelastmodified),now()) LTE 0) and left(name,1) neq ".">
-				 	<cffile action="delete" file="#directory#/#name#">
-				 </cfif>
-			</cfif>
-		<cfelse>
-			<cfdirectory action="list" directory="#directory#/#name#" name="current">
-			<br> got a directory #directory#/#name# containing #current.recordcount# files
-			<cfif current.recordcount is 0>
-				<br>deleting it
-				<cfif (dateCompare(dateAdd("d",7,datelastmodified),now()) LTE 0) and left(name,1) neq ".">
-				 	<cffile action="delete" file="#directory#/#name#">
-				 </cfif>
-			</cfif>
+</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">


<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=showstatus">showstatus</a> - wut?

<!---------------------------------------------------------------------------------------------------------->
<cfif action is "cleanup_local">
	<cfquery name="d" datasource="cf_dbuser">
		 select LOCAL_URI,REMOTE_URI from cf_tacc_transfer where status='media_updated' and rownum<1000
	</cfquery>
	<cfoutput>
		<cfloop query="d">

			<cfset localfPath=replace(LOCAL_URI,#application.serverRootUrl#,'#application.webDirectory#')>

			<cfif fileExists(localfPath)>
				<br>this thing exists:
				<br>localfPath: #localfPath#
				<br>LOCAL_URI: #LOCAL_URI#
				<br>REMOTE_URI: #REMOTE_URI#
