I have the path
of a file stored in a variable (say) filePath. I would like to copy that particular file
to another specific folder within a Python script.
I tried
folderPath = (os.getcwd() +
"/folder_name/") #to get the path of the folder
shutil.copyfile(filePath,
folderPath)
But
I got an error IOError: [Errno 21] Is a
.
directory
How can I solve this
?
My question might seem to be a duplicate of
href="https://stackoverflow.com/questions/123198/how-do-i-copy-a-file-in-python">How
do I copy a file in python?
. But actually, I want to copy a file to
a folder/directory whereas most answers to that question
mention copying one file to another
file.
No comments:
Post a Comment