M HYPE SPLASH
// updates

How to determine if the file download has completed in google chrome?

By John Campbell

I have downloaded a file using google chrome. Now I am wanting to know when it has finished downloading. Possibly through an external app (or command line). I have a direct way. There are issues with it.

If you have the checksum and the filename (somehow) available I can run a powershell program for the same:

$ Get-FileHash ~/Downloads/foo.img

Issue is that some web servers don't provide the filename directly, or, at all. Further, if the filename is not directly accessible, and, its name is quite long such that it appears truncated in the chrome's Downloads bar, there is the apparent chance of assuming the wrong (complete) filename.

Further, we don't have a way to know the status of download. Specifically when the download has interrupted. I am hoping there is some workarounds around this.

1 Answer

If there is a slow ongoing download you can run the following bash script:

#!/bin/bash
file=$1
# echo "File: $file"
while [ 1 ];
do if test -e "$file"; then break; fi sleep 5
done

Simply pass the location of the yet-to-exist (YTE) file as argument to the script.

To determine YTE file name, simply access Google Chrome's downloads page.

enter image description here

The YTE file will be in the user's corresponding folder in the file system. This code can be suitably adapted on Windows 10 machines (or older) through a cygwin-based bash shell, or, powershell.

This approach does not notifiy you of mid-download failures due to network errors.

E.g.

./check-file.sh ~/Downloads/foo.zip && echo "done"

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy