Jump to content

Force downloading file to flush to disk?


lee321987
 Share

Recommended Posts

I have a script that periodically checks a downloading file to make sure it is still growing in size so I can be alerted if the download gets stalled.

Firefox is downloading the file.

Sometimes the file stops growing for a long time even though it is still successfully being downloaded.

If I copy the download and paste the copy then the download gets (flushed to disk?) and it's size is updated.

Does anyone know of a way I can force the download to get flushed to disk without copying it?

Edited by lee321987
Link to comment
Share on other sites

  • lee321987 changed the title to Force downloading file to flush to disk?

It's quite hard to meddle with other processes handle.

https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-flushfilebuffers

To flush all open files on a volume, call FlushFileBuffers with a handle to the volume. The caller must have administrative privileges. For more information, see Running with Special Privileges.

But I guess that will impair overall system performance.

Or as you wrote yourself, copy the file periodically and check the size of the copy.

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...