Index: /branches/eraser6/Manager/DirectExecutor.cs
===================================================================
--- /branches/eraser6/Manager/DirectExecutor.cs	(revision 579)
+++ /branches/eraser6/Manager/DirectExecutor.cs	(revision 580)
@@ -800,5 +800,5 @@
 			//Get the erasure method if the user specified he wants the default.
 			ErasureMethod method = target.Method;
-			
+
 			//Calculate the total amount of data required to finish the wipe.
 			dataTotal = method.CalculateEraseDataSize(paths, dataTotal);
@@ -925,5 +925,5 @@
 
 			//Rename the file a few times to erase the record from the MFT.
-			for (int i = 0, retries = 0; i < FilenameErasePasses; ++i)
+			for (int i = 0, tries = 0; i < FilenameErasePasses; ++tries)
 			{
 				//Rename the file.
@@ -936,12 +936,15 @@
 				{
 					info.MoveTo(newPath);
+					++i;
 				}
 				catch (IOException)
 				{
 					Thread.Sleep(100);
-					// if we have been waiting for more than 3.2 seconds
-					// we should just ignore this, we probably could not access
-					// it in near future
-					if (retries < 32) --i;
+
+					//If after 20 tries the file is still locked, some program is definitely
+					//using the file; throw an exception.
+					if (tries > 20)
+						throw new IOException(string.Format(S._("The file {0} is currently in use " +
+							"and cannot be removed."), info.FullName));
 				}
 			}
