I am using this code:
xargs -n 1 curl -O < urls.txt
to download all image urls from text file.
All images are downloading to home directory.
How can I specify the folder/directory to download to?
curl has no specific option to specify the download directory for -O
. The standard fix for that is to simply make your command line first cd
to the directory you've chosen to download the files into.
Maybe something like this:
#!bin/sh
# figure out where we are
pwd=`pwd`
# go to the download directory
cd /tmp/my-downloads
# Download into the right dir, find the URL file in the original dir
xargs -n 1 curl -O < $pwd/urls.txt