Reputation: 3137
I am using this command
wget -r --accept "*.ext" --level 2 "example.com/index1/"
which is working fine. now i want to define path and file name where i want to save my file
Any suggestions
Thanks
Upvotes: 1
Views: 4030
Reputation: 25449
You can use the -O
option of wget
. For example:
wget -O report.pdf http://www.example.com/files/awkward-name.pdf
Note however, that it is only really useful if you are downloading a single document.
From the manual page:
Use of
-O
is not intended to mean simply “use the name file instead of the one in the URL;” rather, it is analogous to shell redirection:wget -O file http://foo
is intended to work likewget -O - http://foo > file
; file will be truncated immediately, and all downloaded content will be written there.
Since you appear to be using the -r
option, you might be better off downloading all files into a temporary current working directory and only after that is done decide what to do with them.
mkdir /tmp/download/
cd /tmp/download/
wget http://www.example.com/files/awkward-name.pdf
cd -
cp /tmp/download/awkward-name.pdf report.pdf
rm -rf /tmp/download/
Upvotes: 1