Delete A Log File After Printing Access Denied

D

Delta_X

I'm writing a batch file that will print out a 3 log files, copy them to a
removable disk and then delete them to start the log file over. The only
thing is the files are being written to so it won't let them be deleted using
DEL. I need to clear the files after printing and copying so only that days
activity is printed and copied to the removable disk. Any ideas how I can
clear the contents of the old file to start new for the next day? Or if I
used MOVE instead of COPY, would that work because the file is open for
writing?
If this is in the wrong spot please direct me to where I should put it.
 
P

Pegasus \(MVP\)

Delta_X said:
I'm writing a batch file that will print out a 3 log files, copy them to a
removable disk and then delete them to start the log file over. The only
thing is the files are being written to so it won't let them be deleted
using
DEL. I need to clear the files after printing and copying so only that
days
activity is printed and copied to the removable disk. Any ideas how I can
clear the contents of the old file to start new for the next day? Or if I
used MOVE instead of COPY, would that work because the file is open for
writing?
If this is in the wrong spot please direct me to where I should put it.

You need to follow this sequence:
1. Stop the process that writes to the log file.
2. Print the file.
3. Delete the file.
4. Restart the process.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top