自动备份网站和数据库打包并上传FTP服务器并删除前30天文件
@echo off<nul 3>nul
Set nowdate=%date:~0,10%
set nowdate=%nowdate:/=%
Md d:\autobak\"%nowdate:/=-%"\www
Md d:\autobak\"%nowdate:/=-%"\data
forfiles /p d:\autobak /d -30 /c "cmd /c del /f /q /a @path && rd /s /q @path"
xcopy d:\www d:\autobak\"%nowdate:/=-%"\www
xcopy d:\data d:\autobak\"%nowdate:/=-%"\data
cd c:\Program Files\WinRAR\
winrar.exe a -r d:\autobak\"%nowdate:/=-%".zip d:\autobak\"%nowdate:/=-%"\
Echo open 61.136.208.30 >ftp.up
Echo user >>ftp.up
Echo password >>ftp.up
Echo cd neibu-www\ >>ftp.up
Echo lcd D:\autobak>>ftp.up
Echo put "%nowdate:/=-%".zip >>ftp.up
Echo bye>>ftp.up
FTP -s:ftp.up
del ftp.up /q
pause & exit