Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have two CSV files. One contains a url to an image and the other the name i want the image downloaded and saved as. They are two files as it is 3.6 million rows long and I cant combine without blowing up my computer.
Is there a way to use a wget command to download link and rename the file?
wget --spider "https://uc3af9f647b4bcb93f2c716f7d0f.dl.dropboxusercontent.com/cd/0/get/Aiqw78JPywxbsMVjYPY8kiJm-HTa_p5XddLQ6eZi4VhF2XoNQQqNzyvoj3KIQUyQ6Fe8ThO5Q-1H35arCeXumhsXtZB4FW5aW1PeMq638xExdA/file?_download_id=1407438504576448139996869513670874382657307170413355605886783133243&_notify_domain=www.dropbox.com&dl=1"
Spider mode enabled. Check if remote file exists.
--2019-06-12 07:16:56-- https://uc3af9f647b4bcb93f2c716f7d0f.dl.dropboxusercontent.com/cd/0/get/Aiqw78JPywxbsMVjYPY8kiJm-HTa_p5XddLQ6eZi4VhF2XoNQQqNzyvoj3KIQUyQ6Fe8ThO5Q-1H35arCeXumhsXtZB4FW5aW1PeMq638xExdA/file?_download_id=1407438504576448139996869513670874382657307170413355605886783133243&_notify_domain=www.dropbox.com&dl=1
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving uc3af9f647b4bcb93f2c716f7d0f.dl.dropboxusercontent.com (uc3af9f647b4bcb93f2c716f7d0f.dl.dropboxusercontent.com)... 162.125.3.6, 2620:100:6018:6::a27d:306
Connecting to uc3af9f647b4bcb93f2c716f7d0f.dl.dropboxusercontent.com (uc3af9f647b4bcb93f2c716f7d0f.dl.dropboxusercontent.com)|162.125.3.6|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 413788670 (395M) [application/binary]
Code:
wget --spider "https://uccaa835e0962e78259d66cfbd81.dl.dropboxusercontent.com/cd/0/get/AipgxLQRcOaW9UGzsgtyyS20eSKfa36iegeVLzCJ-_8mAAp-1lB3WLh-UI8CQ8RvTDMQEJdh7NxJFqwFA2tI1lDk3-C30fnsXBfXl7r4FzhwFw/file?_download_id=63981500829626411254479516742057535279546930342219265882653689927&_notify_domain=www.dropbox.com&dl=1"
Spider mode enabled. Check if remote file exists.
--2019-06-12 07:19:05-- https://uccaa835e0962e78259d66cfbd81.dl.dropboxusercontent.com/cd/0/get/AipgxLQRcOaW9UGzsgtyyS20eSKfa36iegeVLzCJ-_8mAAp-1lB3WLh-UI8CQ8RvTDMQEJdh7NxJFqwFA2tI1lDk3-C30fnsXBfXl7r4FzhwFw/file?_download_id=63981500829626411254479516742057535279546930342219265882653689927&_notify_domain=www.dropbox.com&dl=1
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving uccaa835e0962e78259d66cfbd81.dl.dropboxusercontent.com (uccaa835e0962e78259d66cfbd81.dl.dropboxusercontent.com)... 162.125.3.6, 2620:100:6018:6::a27d:306
Connecting to uccaa835e0962e78259d66cfbd81.dl.dropboxusercontent.com (uccaa835e0962e78259d66cfbd81.dl.dropboxusercontent.com)|162.125.3.6|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 146592156 (140M) [application/binary]
Thanks for this, I can put the files in the root folder so it doesnt have to check the link (note not sensitive data. I cant see how this code renames the file as the corresponding row in the names CSV? Perhaps i should combine the CSVs first in linux....
For combining the two files line by line you can use paste.
My guess is that it won't blew up your computer, as paste should work with chunk of the two inputs written as chunk of output, without filling up the whole memory.
I used to use wget to download a list of URLs in a file.
$ wget -c -i file_of_urls.txt
Back when I was on dialup and the local rest areas had free wifi with much better connection speeds. Or the local library parking lot. Although back then the laptops battery would only last an hour, so I had to get as much as I could as fast as I could before returning to slumming it status (dialup at home).
You could script it to mv/rename the file after download, but you'd probably need 3 parameters per line in the file. And a variant with only the 1 parameter (URL) for wget. The 2nd and 3rd being what actually downloaded (without URL and $PATH) and it's new name.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.