Answer the question
In order to leave comments, you need to log in
How to make Python code download a folder and unpack it into a directory?
There is this code:
import urllib.request
from getpass import getuser
print('ShelbyFM: radio station installation...')
url = 'http://d.zaix.ru/iTUp.mp3'
urllib.request.urlretrieve(url, 'C:\\Users\\{0}\\Documents\\Rockstar Games\\GTA V\\User Music\\Tes1122t.mp3'.format(getuser()))
Answer the question
In order to leave comments, you need to log in
The code you wrote asks for a specific file, not a folder.
If you just need to download a known list of files, even a large one, it's easier to take a ready-made program, for example, wget, feed this list as a text file as input, and wget will download everything itself.
If you do not know the list, then in order to download the contents of the folder, this content must be seen. And for this, you need to get a list of files through some specific api, then iterate through the list and form links like:
“path to the folder on the server” + “name of the next file“
And request these files in turn, or through a standard http request, or through the service api (depending on the service). Or, again, put the links into a text file and feed the list to wget.
In general, it is necessary to write a somewhat more complex program.
And what is the end goal?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question