Download a file with long path - from internet.

Just starting out? Need help? Post your questions and find answers here.
User avatar
matalog
Enthusiast
Enthusiast
Posts: 312
Joined: Tue Sep 05, 2017 10:07 am

Download a file with long path - from internet.

Post by matalog »

I just want to download a file at a time - the path is something like

Code: Select all

https://d1zfca9r0ctlm4.changedtext.net/21153/22682/54704/20100401/images/8/page-005.jpg?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9kMXpmY2E5cjBjdGxtNC5jbG91ZGZyb250Lm5ldC8yMTE1My8yMjY4Mi81NDcwNC8yMDEwMDQwMS9pbWFnZXMvPy9wYWdlLT8~Pz8~Py5qcGciLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE3Njc2NTc2NjB9LCJEYXRlR3JlYXRlclRoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTc2NzU3MTIwMH0sIklwQWRkcmVzcyI6eyJBV1M6U291cmNlSXAiOiIwLjAuMC4wLzAifX19XX0_&Signature=q7lTipmA8qtLcEtUoI2l5nCch5JdcGRPK-z8EcXnL03eE~J-cD4fO~crpiShn4KjADVkF97LZXKYyIJ~AUqOu9e2CvawxaaURsQCUH~PBCC-oD7IXlo4s58dCci2dD~RwGMNNI6HnbWm1o14J7nqvlDWyVlzwD251DJfpZDI8ck_&Key-Pair-Id=APKAILCKZYUYWFSF3MGH
Wget reports path too long, tries to shorten it and it fails to download obviously.

How could I do this. I have read about libcurl and chilkat but there doesn't seem to be a simple https single file download example.

Any tips for doing this?
BarryG
Addict
Addict
Posts: 4300
Joined: Thu Apr 18, 2019 8:17 am

Re: Download a file with long path - from internet.

Post by BarryG »

Does it work if you remove everything after ".jpg" ?
infratec
Always Here
Always Here
Posts: 7769
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Download a file with long path - from internet.

Post by infratec »

You can download files with curl, you need only to specify the output filename:

http://www.compciv.org/recipes/cli/down ... with-curl/
User avatar
ChrisR
Addict
Addict
Posts: 1528
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: Download a file with long path - from internet.

Post by ChrisR »

You can also use aria2 - The ultra fast download utility
I use it for large files (windows iso) with the parallel fragment download

Code: Select all

aria2c  --log-level=notice --log="E:\Temp\Aria2c_Download.log" -x16 -s16 --allow-overwrite=true --auto-file-renaming=false -d"E:\temp" -o"page-005.jpg" "https://d1zfca9r0ctlm4.changedtext.net/21153/22682/54704/20100401/images/8/page-005.jpg....."
;or with default options (without -d default dir is aria2c path)
aria2c -dE:\temp "https://d1zfca9r0ctlm4.changedtext.net/21153/22682/54704/20100401/images/8/page-005.jpg....."

ErrorCode=19: Name resolution for d1zfca9r0ctlm4.changedtext.net failed:Domain name not found
User avatar
matalog
Enthusiast
Enthusiast
Posts: 312
Joined: Tue Sep 05, 2017 10:07 am

Re: Download a file with long path - from internet.

Post by matalog »

BarryG wrote: Tue Jan 06, 2026 8:40 am Does it work if you remove everything after ".jpg" ?
No, it needs the rest.
User avatar
matalog
Enthusiast
Enthusiast
Posts: 312
Joined: Tue Sep 05, 2017 10:07 am

Re: Download a file with long path - from internet.

Post by matalog »

ChrisR wrote: Tue Jan 06, 2026 10:00 am You can also use aria2 - The ultra fast download utility
I use it for large files (windows iso) with the parallel fragment download

Code: Select all

aria2c  --log-level=notice --log="E:\Temp\Aria2c_Download.log" -x16 -s16 --allow-overwrite=true --auto-file-renaming=false -d"E:\temp" -o"page-005.jpg" "https://d1zfca9r0ctlm4.changedtext.net/21153/22682/54704/20100401/images/8/page-005.jpg....."
;or with default options (without -d default dir is aria2c path)
aria2c -dE:\temp "https://d1zfca9r0ctlm4.changedtext.net/21153/22682/54704/20100401/images/8/page-005.jpg....."

ErrorCode=19: Name resolution for d1zfca9r0ctlm4.changedtext.net failed:Domain name not found
Thanks, I used aria2c from PB, it works well. I just had to pad the RunProgram() strings with Chr(34)'s to get the required Quotation marks within a string.
User avatar
matalog
Enthusiast
Enthusiast
Posts: 312
Joined: Tue Sep 05, 2017 10:07 am

Re: Download a file with long path - from internet.

Post by matalog »

infratec wrote: Tue Jan 06, 2026 9:17 am You can download files with curl, you need only to specify the output filename:

http://www.compciv.org/recipes/cli/down ... with-curl/
Thanks for that infratec.
BarryG
Addict
Addict
Posts: 4300
Joined: Thu Apr 18, 2019 8:17 am

Re: Download a file with long path - from internet.

Post by BarryG »

matalog wrote: Tue Jan 06, 2026 11:43 amThanks for that infratec.
Yes, thanks! Topic bookmarked in case I ever need it in future. :)
User avatar
NicTheQuick
Addict
Addict
Posts: 1543
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: Download a file with long path - from internet.

Post by NicTheQuick »

wget has a lot of possible arguments. With `wget -o <outputfile> <URL>` you can download anything to a file name of your choice.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
User avatar
matalog
Enthusiast
Enthusiast
Posts: 312
Joined: Tue Sep 05, 2017 10:07 am

Re: Download a file with long path - from internet.

Post by matalog »

NicTheQuick wrote: Tue Jan 06, 2026 2:13 pm wget has a lot of possible arguments. With `wget -o <outputfile> <URL>` you can download anything to a file name of your choice.
I have already achieved what I need to do, but I'm curious. Are you suggesting that wget can be used to download a file with a path longer than 300 characters?
User avatar
NicTheQuick
Addict
Addict
Posts: 1543
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: Download a file with long path - from internet.

Post by NicTheQuick »

matalog wrote: Tue Jan 06, 2026 11:08 pm
NicTheQuick wrote: Tue Jan 06, 2026 2:13 pm wget has a lot of possible arguments. With `wget -o <outputfile> <URL>` you can download anything to a file name of your choice.
I have already achieved what I need to do, but I'm curious. Are you suggesting that wget can be used to download a file with a path longer than 300 characters?
It depends on the file system of course. NTFS has a max path length of 32,767 unicode characters but Windows has an internal constant MAX_PATH set to 260 characters which prevents you from creating long path names in most cases.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
BarryG
Addict
Addict
Posts: 4300
Joined: Thu Apr 18, 2019 8:17 am

Re: Download a file with long path - from internet.

Post by BarryG »

NicTheQuick wrote: Wed Jan 07, 2026 10:51 amWindows has an internal constant MAX_PATH set to 260 characters which prevents you from creating long path names in most cases.
You can prefix the path with "\\?\" on Windows to allow paths of 32767 characters, and/or set a Registry key to allow it.

See here: https://learn.microsoft.com/en-us/windo ... limitation
User avatar
matalog
Enthusiast
Enthusiast
Posts: 312
Joined: Tue Sep 05, 2017 10:07 am

Re: Download a file with long path - from internet.

Post by matalog »

NicTheQuick wrote: Wed Jan 07, 2026 10:51 am
matalog wrote: Tue Jan 06, 2026 11:08 pm
NicTheQuick wrote: Tue Jan 06, 2026 2:13 pm wget has a lot of possible arguments. With `wget -o <outputfile> <URL>` you can download anything to a file name of your choice.
I have already achieved what I need to do, but I'm curious. Are you suggesting that wget can be used to download a file with a path longer than 300 characters?
It depends on the file system of course. NTFS has a max path length of 32,767 unicode characters but Windows has an internal constant MAX_PATH set to 260 characters which prevents you from creating long path names in most cases.
I'm not sure I know what you mean. Wget told me that the path was too long and it truncated it, aria2c didn't give me the same warning and worked perfectly with the same path. These programs were both running on the same operating system on the same computer.

This leads me to think that it isn't the way that my Windows is set up, it is something with wget.
User avatar
NicTheQuick
Addict
Addict
Posts: 1543
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: Download a file with long path - from internet.

Post by NicTheQuick »

matalog wrote: Thu Jan 08, 2026 11:40 am I'm not sure I know what you mean. Wget told me that the path was too long and it truncated it, aria2c didn't give me the same warning and worked perfectly with the same path. These programs were both running on the same operating system on the same computer.

This leads me to think that it isn't the way that my Windows is set up, it is something with wget.
Well, you never posted how you used wget. I never used it on Windows. I am on Linux only. And I never had issues with downloading files with wget. And I only use it in den CLI or in a shell script.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Post Reply