asp如何删除指定后缀的文件以外的所有文件?

来源:百度知道 编辑:UC知道 时间:2024/05/10 18:41:51
asp如何删除指定后缀的文件以外的所有文件?

注意,是 删除 除了 指定后缀的文件 以外 的所有文件

谢谢!

NotDel="asp|jpg"
set Fso=createobject("Scripting.filesystemobject")
set M_fso=fso.getfolder(Server.MapPath(Path))
if M_fso.files.count>0 then
for each f in M_fso.files
if instr(NotDel,lcase(mid(f.name,instrRev(f.name,".")+1)))>0 then Fso.DeleteFile(Server.MapPath(Path)&"\"&f.name)
next
end if
Set Fso=Nothing