wgetで場所を指定するには?

ファイルを/tmp/cron_test/にダウンロードする必要があります。私のwgetコードは

wget --random-wait -r -p -nd -e robots=off -A".pdf" -U mozilla http://math.stanford.edu/undergrad/

となりますが、ディレクトリを指定するパラメータはありますか?

ソリューション

マニュアルページより

-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).

ですから、コマンドに -P /tmp/cron_test/ (短い形式) または --directory-prefix=/tmp/cron_test/ (長い形式) を追加する必要があります。また、ディレクトリが存在しない場合は、作成されることに注意してください。

解説 (6)

-Oは、ダウンロード先のファイルのパスを指定するオプションです。

wget  -O /path/to/folder/file.ext

-Pは、ディレクトリ内のファイルをダウンロードするプレフィックス

wget  -P /path/to/folder
解説 (4)

この方法を試してみてください。

import os
path = raw_input("enter the url:")
fold = raw_input("enter the folder:")
os.system('wget -r -nd -l1 -P %s --no-parent -A mp3 %s'%(fold, path))
解説 (2)