Found several solutions for local, but need one for FTP action:
I have a daily batch script to backup MySQL databases locally, however I also ftp them to a backup server.
Locally, I am using forfiles
to delete files older than 14 days:
forfiles -p "C:\whatever" -s -m *.* -d 14 -c "cmd /c del @path"`
The same I would like to do on FTP, once the newest backup files are dumped into FTP server running on Windows Server 2008 R2.
How do I extend my batch file to do this action?
cd\[path to directory where files are saved]
echo off
echo user [ftp username]>ftpup.dat
echo [ftp password]>>ftpup.dat
echo binary>>ftpup.dat
echo put [FullBackup.%backupdate%.zip]>>ftpup.dat
echo quit>>ftpup.dat
ftp -n -s:ftpup.dat [myserver.com]
del ftpup.dat