MoveFile freezing

My program has to move quite a few large files as part of the process, and I have encountered a problem that when I don't run it in a while, the move operations take a really long time to complete, as if they were moving files across volumes (they aren't). I tried both MoveFile and SHFileOperation, but the result is the same. I don't use an anti-virus or anything that might be holding the files (though I'd like to know how to check that).

So basically I have about 20 files with a total size of ~20Gb, and when I move them for the first time, it takes a couple minutes to complete. If I move them again, it only takes like a second or two.

Any insight?
Last edited on
It should be near instantaneous, and it is on POSIX file systems.

Is the system busy when this runs slowly? Is it low on memory? I ask because Windows has this notification mechanism that needs to be fired at some point. If the system is low on resources it may take some time to page stuff in to do all that. The notification ought to be asynchronous, but with Windows you never really know what's going on, it's more psycho-analysis than engineering.

Also, NTFS is transactional. So if it's busy, you can get a backlog of transactions that need to be commited.
Last edited on
No, the system is not busy or low on memory, it happens even if the system has just been started up.

I'm not familiar with how NTFS functions, but that does sound like a possibility.
Last edited on
Does windows explorer exhibit the same behaviour ?

If not, show us the code, including the flags passed to SHFileOperation.
Topic archived. No new replies allowed.