Posted By

qrist0ph on 05/14/08


Tagged

script sysadmin


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

qrist0ph
alexxx


VBS Timestamp Backup Script


 / Published in: Visual Basic
 

copy to sendto folder

  1. path = Wscript.Arguments(0)
  2.  
  3. homedir = left(path,instrrev(path,"\"))
  4. backupDir =homedir
  5.  
  6. Function convert(s)
  7. if (len(s)<2) then
  8. s="0" & s
  9. end if
  10. convert = s
  11. end Function
  12.  
  13.  
  14. Set filesys = CreateObject("Scripting.FileSystemObject")
  15. Set wshShell = WScript.CreateObject ("WSCript.shell")
  16.  
  17. fileName = filesys.GetFileName(path)
  18.  
  19.  
  20. jetztTag =convert(year(now)) & convert(month(now())) & convert(day(now()))
  21. jetztGenau = jetztTag & "_" & convert(hour(now)) & "" & convert(minute(now))
  22.  
  23. if(instr(fileName,".")>0) then
  24. name = left(fileName,instr(fileName,".")-1)
  25. extension = right(file,len(fileName)-instr(fileName,"."))
  26. else
  27. name=fileName
  28. end if
  29.  
  30. command4 = "7z a " & chr(34) & backupDIR & name & "_" & jetztGenau & ".7z" & chr(34) & " " & chr(34) & path & chr(34)
  31.  
  32. wshshell.run "%comspec% /c " & command4
  33. set wshshell = nothing

Report this snippet  

You need to login to post a comment.