A site containing pictures I download is organized in folders
(representing years).
curl http://...0039/a1968/[0-11]-[0-12].jpg -O
Those folders contain files named with numbers exclusive to each
other:
a1968 files go from 0-0.jpg to 3-9.jpg
a1969 files go from 3-10.jpg to 7-2.jpg
a1970 files go from 7-3.jpg to 10-1.jpg
etc.
Consequently, if I do:
curl http://...0039/a[1968-2007]/[0-11]-[0-12].jpg -O
I get lots of invalid jpg files created because a1968/0-0.jpg doesn't
exist. I need them in only 1 folder because I don't care about
years.What should I add to that line to remove those invalid jpg when
they are created?
Thank you!
You can use the --fail option :
$ curl -s -S --fail http://curl.haxx.se/doc[r-s]/manpag[d-e].html -O
curl: (22) The requested URL returned error: 404
curl: (22) The requested URL returned error: 404
curl: (22) The requested URL returned error: 404
$ ls -lrt
total 112
-rw-rw-r-- 1 eric eric 107176 nov 21 21:20 manpage.html
Exactly what I needed! Thank you!