Loading content, please wait..

ASP 刪除整個目錄

'刪目錄
SUB PF_delfolder(sPath)
  dim fso,tmpfolder,tmpsubfolder,tmpfile,tmpfiles
  set fso=server.CreateObject("scripting.FileSystemObject")
   If (fso.FolderExists(server.MapPath (sPath))) then
    set tmpfolder=fso.GetFolder(server.MapPath (sPath))
    set tmpfiles=tmpfolder.files
    for each tmpfile in tmpfiles
     fso.DeleteFile (tmpfile)
    next
    set tmpsubfolder=tmpfolder.SubFolders
    for each tmpfolder in tmpsubfolder
     PF_delfolder(spath&"/"&tmpfolder.name )
    next
    fso.DeleteFolder (server.MapPath (sPath))
   end if
end sub

Other