Vas
asked on
Windows scripted FORFILES / del function (on Server 2012)
I'm using a script that I got from here which automates a mySQL dump of all databases, .zip's them, and then deletes all the .zip files older that what you specify:
http://www.redolive.com/utah-web-designers-blog/automated-mysql-backup-for-windows/
The site says the script is tested on Server 2008. I'm running this on Server 2012.
The script is working except for the delete the older .zip files part, which is this line of the script:
If I run the script from the command line, at this part it errors with:
ERROR: Invalid argument/option - '/q'.
Type "FORFILES /?" for usage.
If I remove the /q part from the script just to see what happens, it then complains about a different part of the command:
ERROR: Invalid argument/option - '@path'.
Type "FORFILES /?" for usage.
This is the only script I found that can automate MySQL backups on WIndows fully (with archiving, deleted .sql files, and then deleting older .zip files).
I'm guessing something must be different in Server 2012.
Any idea what should be fixed for that line above?
Thank you
http://www.redolive.com/utah-web-designers-blog/automated-mysql-backup-for-windows/
The site says the script is tested on Server 2008. I'm running this on Server 2012.
The script is working except for the delete the older .zip files part, which is this line of the script:
echo “Deleting zip files older than x days now”
Forfiles -p %backupfldr% -s -m *.* -d -%retaindays% -c “cmd /c del /q @path”
If I run the script from the command line, at this part it errors with:
ERROR: Invalid argument/option - '/q'.
Type "FORFILES /?" for usage.
If I remove the /q part from the script just to see what happens, it then complains about a different part of the command:
ERROR: Invalid argument/option - '@path'.
Type "FORFILES /?" for usage.
This is the only script I found that can automate MySQL backups on WIndows fully (with archiving, deleted .sql files, and then deleting older .zip files).
I'm guessing something must be different in Server 2012.
Any idea what should be fixed for that line above?
Thank you
ASKER
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That fixed it thanks!
You'll notice that the quotes around the command are "prettified". Delete all these "curly" quotes and replace them with proper straight ones, then try again.
Open in new window