0xddr
0xddr

Reputation: 65

"IOException: There is not enough space on the disk." while there is enough space

I made sequence of operations (on local disk):

  1. Copy file to ###.bak
  2. Save file to ###
  3. Delete file ###.bak

Code:

File.Copy(filename, filename + ".bak");
TextWriter writer = new StreamWriter(filename);
writer.Write(content);
writer.Close();
File.Delete(filename + ".bak");

During deleting I got exception:

IOException: There is not enough space on the disk.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)

Size of both files is maximum few MB. And I checked - there is enough free space on disk (more than few GBs). What are possible reasons for that situations?

It's a desktop app (WPF), running on OS drive, on admin account.

Upvotes: 1

Views: 9008

Answers (2)

S T Chan
S T Chan

Reputation: 111

Are you using disk quotas? If yes, maybe on the server that it failed on, that account was using a lot of disk at that time.

Upvotes: 0

themarcuz
themarcuz

Reputation: 2583

Are you making this operation on an hard drive different from the OS one? Maybe you have lot of space in drive D, but when deleting the file you're actually moving it in the recycle-bin, that is in C drive. Try to check this...

Upvotes: 0

Related Questions