How to specify the location with wget?

后端 未结 5 1507
梦毁少年i
梦毁少年i 2020-12-04 04:27

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/u         


        
5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-04 05:14

    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.

提交回复
热议问题