开发者

forfiles not working in scheduled task

I have created a batch file with the following line:

forfiles /p L:\percepsrvr\SQL开发者_如何学Go /s /m *.bak /d -4 /c "cmd /c del /q @PATH "

This deletes any files older than 3 days and works when I run the batch file.

However, when I try to run this batch file as part of a scheduled task the line of code fails to execute. I think it might be because of the mapped network drive (L:) but don't know for sure.

I have the scheduled task running as myself to make sure it has the same permissions as when I run it manually. The scheduled task is running on a Win2008r2 server box and L:\ is on a Win2003 SP2 server box.

Anyone know what might be keeping this from working properly or how to debug a scheduled task?

TIA Brian


In case anyone comes across this post I found a solution as follows:

ROBOCOPY "D:\Backup Data\percepsrvr\SQL" "\\belgrade\v$\percepsrvr\SQL"

ROBOCOPY "\\belgrade\v$\percepsrvr\SQL" "\\belgrade\v$\percepsrvr\SQL\Old" *.* /move /minage:10
DEL "\\belgrade\v$\percepsrvr\SQL\Old\*.*" /Q

Basically, move the files to delete to another directory and then delete that directory (which can be done with RoboCopy).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜