<!--#include file="Inc/Const.asp" -->
<%
' 删除无用的上传进度数据文件
Dim Action

Action = iXs.ReqNum("Action")
If Action = "" Then Action = 0

If Action = 1 Then
	If DeleteUpDateFile("UpLoadData") = True Then
		Call iXs.Alert("一天前的文件进度垃圾已经全部清理成功！", 0, 0)
	Else
		Call iXs.Alert("清理成功，可能是因为您的空间不支持FSO！", 0, 0)
	End If
Else
	Dim UpLoaddingDate
	iXs.ReqNumLen = 18
	UpLoaddingDate = iXs.ReqNum("UpLoaddingDate")
	If UpLoaddingDate = "" Then UpLoaddingDate = 0
	
	Call Fso_DelFile("UpLoadData/" & UpLoaddingDate & ".js")
	' 也可以调用DeleteUpDateFile
	' 甚至可以修改直接删除所有文件而不是一天前的文件，这样也不会影响系统的运行
	' DeleteUpDateFile("UpLoadData")
End If
' ============================================
' 删除指定的文件
' ============================================
Function Fso_DelFile(FilePath)
	On Error Resume Next
	Dim Fso, F1
	Fso_DelFile = False
	Set Fso = Server.CreateObject("Scripting.FileSystemObject")
	If Err Then Err.Clear : Exit Function
	If (Fso.FileExists(Server.MapPath(FilePath))) Then
		' 文件存在
		Fso.DeleteFile(Server.MapPath(FilePath))
		Fso_DelFile = True
	End If
	Set Fso = Nothing
End Function
' ============================================
' 清理进度垃圾
' ============================================
Function DeleteUpDateFile(FilePath)
	On Error Resume Next
	DeleteUpDateFile = False
	Dim Fso, F, F1, Fc, S
	Set Fso = CreateObject("Scripting.FileSystemObject")
	If Err Then Err.Clear : Exit Function
	Set F = Fso.GetFolder(Server.MapPath(FilePath))
	Set Fc = F.Files
	For Each F1 In Fc
		If Clng(Left(F1.Name, 8)) <= Clng(Left(iXs.FormatTime(Now(), 5), 8) - 1) Then
			' 如果是一天前的，则删除
			Call Fso_DelFile("UpLoadData/" & F1.Name)
		Else
			' 如果扩张名不是.JS，则删除
			If UCase(Right(F1.Name, 4)) <> ".JS" Then Call Fso_DelFile("UpLoadData/" & F1.Name)
		End If
		Response.Flush()
	Next
	Set Fc = Nothing
	Set Fso = Nothing
	DeleteUpDateFile = True
End Function
%>