I need a batch script for backup to zip and copy a folder from C into another network drive. The name of back will be current date. Any solution about that?
Cheers
答案 0 :(得分:0)
以下是示例脚本。 这对你有帮助。
@echo off
ROBOCOPY C:\Test \\192.168.8.160\Test_Share\Backup_%date:~-4,4%%date:~-10,2%%date:~-7,2%
"C:\Program Files\WinRAR\WinRAR.exe" a -r D:\Backup_%date:~-4,4%%date:~-10,2%%date:~-7,2%.rar :: This will archive in .rar \\192.168.8.160\Test_Share\Backup_%date:~-4,4%%date:~-10,2%%date:~-7,2%
echo Automatic Sheduled Backup at %date% >> D:\Backup\log.txt
forfiles /p "D:\Backup" /s /m *.* /D -7 /C "cmd /c del @path" :: Will delete files alder than 7
pause