圆月山庄资源网 Design By www.vgjia.com
复制代码 代码如下:
option explicit
dim fpath,fso,logfile,fwrite
fpath=inputbox ("输入目标文件夹","文件处理器")
logfile="logfile.txt"
set fso=createobject("scripting.filesystemobject")
Set fwrite=fso.opentextfile(logfile,8,true)
getfilename fpath
fwrite.close
Set fso=Nothing
MsgBox "命令执行完成!"
function getfilename(path)
dim file,folder,sfolder,fname,subfolder,Files
if not fso.folderexists(path) then
set fso=nothing
msgbox "目标文件夹不存在!"
exit function
end if
set folder=fso.getfolder(path)
set files=folder.files
for each file in Files
fwrite.writeline path&"\"&file.name
If file.DateLastModified < Now - 10 Then '判断是否超过10天
fso.DeleteFile(file)
'Wscript.Echo file
End If
next
set subfolder=folder.subfolders
for each sfolder in subfolder
fwrite.writeline path&"\"&sfolder.name
If sfolder.DateCreated < Now - 10 Then '判断是否超过10天
fso.deletefolder(sfolder)
'Wscript.Echo file
End If
next
end function

将上面代码存为vbs文件即可使用。
标签:
vbs,自动删除

圆月山庄资源网 Design By www.vgjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
圆月山庄资源网 Design By www.vgjia.com