I came across this solution to emptying a locked file ( console.log )
when i was writing a batch file for rotating logs in Windows 2000.
Attempting to write to the file with the echo command gave me:
The process cannot access the file because it is being used by another
process.
Attempting to delete the file using explorer gave me:
Error Deleting File or Folder
Cannot Delete: <file> there has been a sharing violation.
The source or destination file may be in use.
Anyhow you can get round this by copying one file over the other like
this:
copy clear.txt console.log
Windows will allow you to do that.
> Attempting to write to the file with the echo command gave me:
> The process cannot access the file because it is being used by another
> process.
> I came across this solution to emptying a locked file ( console.log )
> copy clear.txt console.log
I prefer another solution:
IF EXIST console.bak DEL console.bak
REN console.log *.bak
Deleting locked files with FORCEDEL.EXE is discussed at
http://www.codeguru.com/Cpp/W-P/files/fileio/article.php/c1287/
Bye,
v
Sr.