filepath = input('please input the url file path: ')
links = open ('urls.txt', 'r')
newpath = input('Where would you like to store the file? ')
for link in links:
# Get one line of text (e.g. C:\user\path\directory),
# then get the filename from the end of the URL
link = link.strip ()
filename = link.rsplit ('/', 1)[-1]
# Does this file exist in this folder? If not, download it
if not (os.path.isfile (filename)):
print ('Downloading: ' + newpath + filename)
urllib.request.urlretrieve (link, newpath + filename)
newfilename = input (" Type in the new name for the file: ")
print ("File size was", os.path.getsize (filename))
except Exception as inst:
print (' Encountered unknown error. Continuing.')
# File exists; don't download
print ("This file exists already.")
# End of program
print ("Finished downloading.")
I have been trying to wrack my brain around this but to say my brain is 404 would be an understatement.
if anyone could help me fix my problems or assist i would greatly appreciate it.
If you'd tell us what the problem(s) are, and/or where in the program it is "going wrong", then we might be able to assist ...
Please follow-up to let us know how you made out. For good karma, mark a reply as the answer if it helped!