copy - Python copying a folder many times -
I am writing a code that asks the user to enter an input to copy a folder. The number of times the user wants to get the code then start copying the folder and rename it like a series like this:
How often do you want to copy the "moh" folder? Are you 5
Create 5 copies of the folder named (1, 2, 3, 4, 5)
progs = int (raw_input ("Progs Number: ")) FullPath = currentDirectory + str (name) if os.path.isdir (fullPath): # Name of the directory is valid and does not already exist. ,) # This code should be copied to the process, but I do not know how this process has been repeated by user input and rename the folder: os.mkdir (fullpath)
when you do something If so, the way to do this is usually a loop on the Now, that is a number from And now, You know what to copy: range (n):
in the range for the coop:
i
0-4, and you enter the path in the string value of full path
in i + 1
Want a name, is not it? Therefore, translate dragon into English:
pathname = os.path.join (full path, str (i + 1))
shutil.copy (temptation, path name)
Comments
Post a Comment