I can't wget
while there is no path already to save. I mean, wget
doens't work for the non-existing save paths. For e.g:
wget -O /path/to/image/new_image.jpg http://www.example.com/old_image.jpg
If /path/to/image/
is not previously existed, it always returns:
No such file or directory
How can i make it work to automatically create the path and save?
When downloading a file, Wget stores it in the current directory by default. You can change that by using the -P option to specify the name of the directory where you want to save the file. Download the jQuery file you downloaded previously, but this time save it in the Downloads subdirectory.
Downloading Desired Directories Recursively Probably, mirroring the whole website like above would not be helpful because of its inflexibility. Generally, we would like to get specific directories according to our needs. Fortunately, wget enables us to do so as well.
If you specify the output file using the -O option it will overwrite any existing file. Run multiple times will keep over-writting index.
By default, downloaded file will be saved with the last name mentioned in the URL. To save file with a different name option O can be used. Syntax: wget -O <fileName><URL>
Try curl
curl http://www.site.org/image.jpg --create-dirs -o /path/to/save/images.jpg
mkdir -p /path/i/want && wget -O /path/i/want/image.jpg http://www.com/image.jpg
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With