import os.path import urllib.request 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) try : 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 (inst) print ( ' Encountered unknown error. Continuing.' ) # File exists; don't download else : 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.
... View more