Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

wget file name is too long

1,827 views
Skip to first unread message

Erik Xavior

unread,
Apr 26, 2009, 8:20:10 AM4/26/09
to
Hi!

I've got a little script, what gives wget some URLs to download, the URL-s are not soo long, but, the URL's are redirected, then they are too long:

wget $(script)

Cannot write to something?attredirects=0auth=ANoY7cqi24QEtZt9tVRYpcBnR5N5Y6sU0eERgXUdKmJCYKN7thBmfdghjfdsdo6ihFwUpTG1Wmtp4qjzZmwT89LWaDNKZVMJt55_cf7jiH_OK1ksL4CsunFBVObD4aRF3JvyouZ2xkjM2-X1mqwWyUisM8BkR5w_rdhfbgvhjdkertjuhfzdjrktgjhfdnfmjhg6aT1xC4PgIjg==' (File name too long).


If it would be only one file/URL, I could use the "wget -O filename" option, but in this case, I have a number of URL's from a script
The only static thing I see here, is that the long URL's are usually like this: "filename?saadlfjanvyxhvuasdhrarf" so they're separated by a question mark

I read mailing list like:
http://www.mail-archive.com/wg...@sunsite.dk/msg07322.html

and it say's theres a wget option:
-tc, --trimcharacter char cut filename after character, such as "_"

but it doesn't work for me, and I got a question mark (?) for separator

could anyone give any tips? :)

thank you in advance

Eduardo M KALINOWSKI

unread,
Apr 26, 2009, 8:40:11 AM4/26/09
to

How are you passing this option? '?' is a shell meta-character, so you
should use something like
wget -tc '?'
to prevent expansion.

> could anyone give any tips? :)

The --content-disposition option could also help.

--
Home is the place where, when you have to go there, they have to take you in.
-- Robert Frost, "The Death of the Hired Man"

Eduardo M KALINOWSKI
edu...@kalinowski.com.br


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Erik Xavior

unread,
Apr 26, 2009, 9:10:08 AM4/26/09
to
$ wget -tc '?' URL
wget: --tries: Invalid number `c'.

$ wget --trimcharacter '?' URL
wget: unrecognized option `--trimcharacter'
Usage: wget [OPTION]... [URL]...

Try `wget --help' for more options.


man wget says nothing about -tc
my wget version: 1.11.4-2


"--content-disposition" still gives "filename too long"

Florian Kulzer

unread,
Apr 26, 2009, 5:30:12 PM4/26/09
to

Base on your original statement of the problem (please try to keep the
relevant context in the messages as the discussion progress), something
like this might be an acceptable, though clunky, solution:

for URL in $(script); do wget -O $(echo "${URL#*://}" | tr / _) "$URL"; done

This bash-snippet loops of the URLs in the output of your script and
calls wget such that each page is saved under the name of the original,
non-redirected URL. Basic sanitizing of the output filenames is
performed by removing the scheme name from the beginning of the URLs and
replacing all slashes with underscores.

--
Regards, | http://users.icfo.es/Florian.Kulzer
Florian |

Erik Xavior

unread,
Apr 27, 2009, 1:20:36 PM4/27/09
to
yes, thank you, thats it!!

the script, that was giving URL's to the wget, is from an older mailing list archive, it get's the url's out of an html file, in my case it's a wget-ed sites.google.com" html file:

for URL in $(perl -ne 'print "$1\n" while (/href=\"(.+?)\"/ig)' site.html | grep "attredirects=" | grep "http://"); do wget -O $(echo "${URL#*://}" | tr / _) "$URL"; done

wow. thanks!! :)

sanju121

unread,
May 18, 2009, 12:50:07 AM5/18/09
to

I’ve been using the soft at www.pathtoolong.com that resolves the long
http://www.pathtoolong.com filename & path issue and deletes locked files.
--
View this message in context: http://www.nabble.com/wget-file-name-is-too-long-tp23241664p23590988.html
Sent from the Debian User mailing list archive at Nabble.com.

0 new messages