On Thu, 2005-04-21 at 17:45 +0800, Qiangning Hong wrote: > I want to download some jpg's whose URL is as > http://some.site/show.php?id=100. In firefox, the downloaded filename > is correctly as "somefile.jpg", but if I download it using wget or > curl, the downloaded file name is "show.php?id=100", which is not > acceptable. Can anyone give me a hint to use command line tool to > download such kind of files with correct filename?
I think you're right, curl and wget don't support giving the file the correct file name. As a workaround, this line will give the server-suggested file name: curl -I $URL 2>/dev/null | sed 's/Content-\(Type\|disposition\):.*\< \(file\)\?name="\(.*\)".*$/\3/;ta;d;:a;q' You could then use: wget $URL -o "$(curl -I $URL 2>/dev/null | sed 's/Content-\(Type\| disposition\):.*\<\(file\)\?name="\(.*\)".*$/\3/;ta;d;:a;q')" -- gentoo-user@gentoo.org mailing list