Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to delete certain files not working 2

Status
Not open for further replies.

ceil32

MIS
Apr 8, 2008
263
IE
I have the following saved as a batch file on a server desktop:

---------
E:\
cd folder1
cd folder2
cd folder3
cd folder4
del *.log
del r3111*

--------

The delete commands work individually from a command line, but won't work in a script.

Can anyone tell me where I'm going wrong?
 
hi,
first of all, put a

pause

at the end of the script, and leave it always active.

In debug phase, put other "pause" after critical commands,
that after you comment.

All this to see errors.

Probably you need to add /Q qualifier (see help del),
to avoid confirmation request when you use wildcards (*)

bye
victor

 
del /q is probably the problem.

del e:\folder1\folder2\folder3\folder4\*.log /q

would save some lines in the script. Also, why not try to stop the logs from being written if all you are doing is deleting them?
 
Works perfect thanks - logs are output from submitted jobs on an ERP system - no way of stopping them
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top