您的位置:首页 > 其它

项目文件自动备份及删除

2009-12-08 16:47 323 查看
projects_backup.vbs

=============================

dim oShell,dateFile,cmd
dateFile=cstr(year(now))&right("00" & cstr(month(now)),2)&right("00" & cstr(day(now)),2)
cmd="cmd /c @xcopy E:/projects E:/backup/projects/autoback/"&dateFile&" /s/e/r/i"
set oShell = WScript.CreateObject ("WSCript.shell")
oShell.run cmd,0
set oShell = Nothing

projects_delbackup.vbs

=============================

'60天前的自动del
dim oShell,thedate,cmd,saveDateNum
saveDateNum=-60
set oShell = WScript.CreateObject ("WSCript.shell")
for i=-14 to -1
thedate=dateadd("d",saveDateNum+i,now)
thedate=cstr(year(thedate))&right("00" & cstr(month(thedate)),2)&right("00" & cstr(day(thedate)),2)
on error resume next
cmd="cmd /c @rd E:/backup/projects/autoback/"&thedate&"/ /q/s"
oShell.run cmd,0
next
set oShell = Nothing
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: