Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a Windows 2000 box running Apache that's running out of disk space. We can't shut down or restart Apache to clear the lock (I'm a UNIX guy, not sure what the equivelant term for Windows is) on the file because it takes too long to restart.

Trying something like

ren access_log access_log.bak


del access_log

results in

The process cannot access the file because it is being used by another process.

How do we clear down the file without taking down Apache?

share|improve this question
up vote 0 down vote accepted

Apache is currently using that file, the only real way is to kill the process that the file is being used by, Apache.

You can try using Unlocker on the file and see if you can remove the lock, it could help.

share|improve this answer

Don't think this will work for Windows 2000 (quick google says PowerShell for Win 2000 is not supported) but I found this forum post that works for me on Win 7, figured I'd share it here for others looking to do the same:

Basically, get yourself a copy of Windows PowerShell and run this command:

while ($true) { gci c:\some\dir -recurse -Include mylogfile.log | ? { $_.length -gt 100mb } | Clear-Content; sleep 15 }

This will truncate the log file every time it grows above 100MB for as long as you let the command run.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.