December 16, 2016 at 11:59 am
Hi
I am calling this below command from .cmd batch file as I have no SQL Agent (express edition). But getting the below error while I try to run that in command prompt.
What is the cause of the error? Is this a syntactical error?
forfiles -p "C:\Program Files\Microsoft SQL Server\Backup\" -s -m *.bak -d -5 -c "cmd /c del @path"
Error:
ERROR: Invalid argument/option - '@path'.
Type "FORFILES /?" for usage.
Thanks.
December 16, 2016 at 1:29 pm
SQL-DBA-01 (12/16/2016)
HiI am calling this below command from .cmd batch file as I have no SQL Agent (express edition). But getting the below error while I try to run that in command prompt.
What is the cause of the error? Is this a syntactical error?
forfiles -p "C:\Program Files\Microsoft SQL Server\Backup\" -s -m *.bak -d -5 -c "cmd /c del @path"
Error:
ERROR: Invalid argument/option - '@path'.
Type "FORFILES /?" for usage.
Try using cmd.exe instead of just cmd and see if that makes a difference.
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
December 16, 2016 at 1:35 pm
the example here:
http://ss64.com/nt/syntax-delolder.html
is so close to your version, i'm not sure there's an issue:
the only thing i see is that the example uses slashes instead of hypens for the parameters.
forfiles /p "C:\source_folder" /s /m *.* /c "cmd /c Del @path" /d -7
Lowell
December 18, 2016 at 9:39 pm
This was removed by the editor as SPAM
December 18, 2016 at 9:57 pm
SQL-DBA-01 (12/16/2016)
HiI am calling this below command from .cmd batch file as I have no SQL Agent (express edition). But getting the below error while I try to run that in command prompt.
What is the cause of the error? Is this a syntactical error?
forfiles -p "C:\Program Files\Microsoft SQL Server\Backup\" -s -m *.bak -d -5 -c "cmd /c del @path"
Error:
ERROR: Invalid argument/option - '@path'.
Type "FORFILES /?" for usage.
You should not be deleting backup files according to the number of days or by date because <insert drum roll here> if something has been going wrong with your backups, you may end up with NO backup files.
You need to make sure that some backup files are present within (according to your code) the 5 days before you go deleting backups that are older than 5 days. Voice of experience here on this one.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply