Hello does anyone know how to copy a file from one directory to another? I have used the "shutil.copy2" it works and gets the copies to the specified output.
Though, my goal is being able to copy files from one directory to another, allowing users to specify which files they want to copy by name. Rather than having to input the dir path every time.
Thought process: Since I specify the file directory. Somehow using a raw_input user can specify which file they want to copy from the specified directory. Posted my code for reference. #Please not BS comments I am new to coding, just trying to learn.
#----------------------------------------------------------------------------------------------------------------#
# These params will be used for specifying which template you want to copy and where to output
#----------------------------------------------------------------------------------------------------------------#
'''Load file from x directory into current working directory '''
#PullTemplate: Specify which template you want to copy, by directory path
TemplateRepo = ("/home/hadoop/BackupFolders/Munge_Stage_Templates/Templates")
user_input = raw_input("which file do you want to pull:")
#OutputTemplate: Let's you specify where you want to output the copied template.
#Originally set to your current working directory (u".")
OutputTemplate = (u".")
#----------------------------------------------------------------------------------------------------------------#
# STATIC CODE: Do not alter "Just Run!"
#----------------------------------------------------------------------------------------------------------------#
shutil.copy2(TemplateRepo, OutputTemplate)