-
<%
-
-
'获取几级文件夹或文件名称
-
arr=Split(Request.ServerVariables("SCRIPT_NAME"),"/")
-
wenjianjia_name=arr(2)
-
response.Write(wenjianjia_name&"<br
/>" )
-
-
'文件所在文件夹名称
-
cur_URL
= ".")Server.MapPath(
-
arr_curURL
= "\")split(cur_URL,
-
len_arr
= ubound(arr_curURL)
-
this_curURL=
arr_curURL(len_arr)
-
response.Write(this_curURL&"<br
/>" )
-
-
'文件名称
-
cur_URL
= "url")Request.ServerVariables(
-
arr_curURL
= "/")split(cur_URL,
-
len_arr
= ubound(arr_curURL)
-
this_curURL=
arr_curURL(len_arr)
-
response.Write(this_curURL&"<br
/>" )
-
-
folder="www.yuzhiguo.com"'需要创建的文件夹名称
-
-
Call
createfolder(folder)
-
-
Function
createfolder(folder)
-
set
fs=createobject( "scripting.filesystemobject")
-
url=server.mappath(folder)
-
if
Not fs.folderexists(url) then
-
fs.createfolder(url)
-
"创建成功!<brResponse.write url& />"
-
else
-
Response.write "存在!<brurl& />"
-
end
if
-
End
Function
-
-
-
'-------------------复制文件--------
-
TempSource=
Server.MapPath( "/yuzhiguo.jpg")'源文件
-
TempEnd=Server.MapPath(folder&"/yuzhiguo.jpg")'移动目标地
-
Call
CopyFiles(TempSource,TempEnd)
-
-
Function
CopyFiles(TempSource,TempEnd)
-
DimFSO
-
SetFSO "Scripting.FileSystemObject")= Server.CreateObject(
-
IF
FSO.FileExists(TempEnd) then
-
"目标备份文件Response.Write <b>" & "</b>TempEnd & 已存在,请先删除!<br />"
-
SetFSO= Nothing
-
ExitFunction
-
EndIF
-
ThenIF FSO.FileExists(TempSource)
-
Else
-
"要复制的源数据文件Response.Write <b>" &TempSource&"</b>不存在!<br />"
-
SetFSO= Nothing
-
ExitFunction
-
EndIf
-
FSO.CopyFile TempSource,TempEnd
-
"已经成功复制文件Response.Write <b>" &TempSource&"</b>到 &TempEnd&"</b><br<b>" />"
-
SetFSO Nothing=
-
End
Function
-
-
'-------------------删除文件夹--------
-
strFolder="www.yuzhiguo.com"'需要删除的文件夹名称
-
Call
DeleteFolder(strFolder)
-
-
Function
DeleteFolder(strFolder)
-
'首选判断要建立的文件夹是否已经存在
-
DimstrTestFolder, objFSO
-
strTestFolder = Server.Mappath(strFolder)
-
SetobjFSO "Scripting.FileSystemObject")= CreateObject(
-
'检查文件夹是否存在
-
IfobjFSO.FolderExists(strTestFolder) Then
-
objFSO.DeleteFolder(strTestFolder)
-
"<fontresponse.write color=red>删除成功!</font><br />"
-
Else
-
"<fontresponse.write color=red>该文件夹不存在!</font>"
-
EndIf
-
SetobjFSO Nothing=
-
End
Function
- %>
相关文章: