lee321987 Posted September 24, 2022 Share Posted September 24, 2022 (edited) 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 September 25, 2022 by lee321987 Link to comment Share on other sites More sharing options...
KaFu Posted September 24, 2022 Share Posted September 24, 2022 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. lee321987 1 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
lee321987 Posted October 26, 2022 Author Share Posted October 26, 2022 (edited) Just found out, this will force the file "foo.txt" to flush to disk: FileRead("foo.txt", 1) Edited October 26, 2022 by lee321987 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now