How to specify the download location with wget?

wget

Solution

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.

Problem

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?

Original source