How to specify the download location with wget?
I need files to be downloaded to /tmp/cron_test/. My wget code is
wget --random-wait -r -p -nd -e robots=off -A".pdf" -U mozilla http://math.stanford.edu/undergrad/
So is there some parameter to specify the directory?
From the manual page:
-P prefix
--directory-prefix=prefix
Set directory prefix to prefix. The directory prefix is the
directory where all other files and sub-directories will be
saved to, i.e. the top of the retrieval tree. The default
is . (the current directory).
So you need to add -P /tmp/cron_test/
(short form) or --directory-prefix=/tmp/cron_test/
(long form) to your command. Also note that if the directory does not exist it will get created.
-O
is the option to specify the path of the file you want to download to:
wget <uri> -O /path/to/file.ext
-P
is prefix where it will download the file in the directory:
wget <uri> -P /path/to/folder