wget -O for non-existing save path?

夏期劇場 picture 夏期劇場 · Jun 29, 2012 · Viewed 29.2k times · Source

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?

Answer

kev picture kev · Jun 29, 2012

Try curl

curl http://www.site.org/image.jpg --create-dirs -o /path/to/save/images.jpg