0

I am trying to download all files from a downloads.list file which contains about 60 lines of URL to download .deb packages from my Ubuntu computer which is not connected to the internet due to lack of wifi. I have internet access to my phone. My question is, is there an app or binary to download the URL of files listed on a .txt or .list file?

5
  • I don't think there's any app for that. You could write a shell script easily to do it.
    – Gokul NC
    Commented May 5, 2016 at 7:24
  • @GokulNC actually tasker has this capability. But I agree with you that a simple shell script is the easier and faster approach here, as long as something like wget is available on the device: while read url; do wget $url; done <file.txt (just out-of-my-head, might need some syntax polish ;)
    – Izzy
    Commented May 5, 2016 at 10:50
  • 2
    @Izzy yeah, we can also open the URL using browser automatically from terminal and let the browser manage the download
    – Gokul NC
    Commented May 5, 2016 at 10:54
  • Exactly (as long as it doesn't ask dumb questions like what to do with the link/file :) Mind setting up an answer? Browser should be available on every device, shell as well, a terminal app can be installed. Of course there also might be a Download Manager covering that in a GUI – I've not tried any of them.
    – Izzy
    Commented May 5, 2016 at 11:04
  • 1
    Why didn't you use tethering to share your phone internet to Ubuntu ?
    – 林果皞
    Commented May 5, 2016 at 11:15

1 Answer 1

2

I just wrote a shell script to do it:

#!/system/bin/sh
while read url; do
am start -a android.intent.action.VIEW -n com.android.chrome/com.google.android.apps.chrome.Main -d $url
done < file.txt

This just reads each line from file.txt, opens the URL using Google Chrome Browser (using com.android.chrome package's MainActivity) and let Google Chrome manage the download.

As @Izzy said, you can also use this script to download using Download Managers, you've to just change the app package name and the corresponding Activity Name in the script.

Edit:
I just figured it out for Advanced Download Manager:

am start -a android.intent.action.VIEW -n com.dv.adm/.AEditor -d $url

Note:
The names of application package and Activity Name are subject to change as per the developer's wish. Use it accordingly.

2
  • Ooh, and make sure the file.txt is in UNIX format (using \n for new line, instead of \r\n as in Windows format). You can use dos2unix to easily convert to Unix format
    – Gokul NC
    Commented May 5, 2016 at 11:56
  • This is great, I've been looking for a way to simply download a file from a script. I didn't know Chrome could be launched like this. I don't suppose it could be told where to store the file too?
    – Nate
    Commented Mar 9, 2020 at 21:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .