As said in the title, I'm trying to write a script in python 2.7 that downloads files off of a link and moves it to a specific folder. I'm doing this using raw_input
and the os module. But the raw_input
for the fileLocation
variable isn't registering for the os.system()
operation.
I've attempted to instead use two different methods, both use the command line. The first involves using the mv
operation in an os.system()
operation. The exact code is os.system('mv {} {}'.format(fileName, fileLocation))
. The other runs a cd
operation through the command line in an attempt to change the download location.
Here is the code:
link = raw_input('Link: ')
fileLocation = raw_input('Input File Location: ')
os.system('cd {}'.format(fileLocation))
os.system('curl -O {}'.format(link))
# os.system('mv {} {}'.format(fileName, fileLocation))
The output is clean and shows no errors. What I want to happen is for the file to be downloaded, and then immediately moved to the specified folder using the raw_input
operation in fileLocation on line 2, but the file is instead downloaded and kept in the home folder for my user profile.