I need to download a zip file using wget. To download it in current directory I run in command line:
$ wget https://github.com/.../[myfile].zip
To download it in a different different directory I add -P <Path of download directory>:
$ wget -P [download directory path] https://github.com/.../[myFile].zip
I want to change to download the file into [download path directory] but with filename [myFileName]. How can I do this?
I've already tried this:
$ wget -P [download directory path] --output-document=[filename.zip]
https://github.com/.../[myZipFile].zip
This downloads the file into current directory with filename chose by me.
Finnaly I will use this into a NodeJS project using spawn.
Currently I have this:
var downloader = spawn("wget", ["-P", zipFile, appUrl]);
Maybe I'm missing the point of the Q, but what about the -O flag?
wget -O [download directory path]/[filename.zip] https://github.com/.../[myZipFile].zip
The man page has scary stuff about files concatenated, but that won't matter when you are only fetching one file.
To auto-create the directory first:
mkdir -p [download directory path]; wget -O [download directory path]/[filename.zip] https://github.com/.../[myZipFile].zip
the -p (parents) flag on mkdir causes it to exit without an error if the directory already exists.