Delete A Log File After Printing Access Denied

  • Thread starter Thread starter Delta_X
  • Start date Start date
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.
 
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.
 
Back
Top