I am using the following code to copy the contents of one directory to another directory (python)
shutil.copytree(sourceDirectory,destinationDirectory,symlinks=False,ignore=ignore_patterns(updatedList))
where
updatedList = ,.config,.ico,*.log
I am generating this updatedList on the fly (based on user inputs) However I keep getting the following error whenever I try to perform the copy operation as stated above.
[Error 183] Cannot create a file when that file already exists
Note : There will be some files that are present in the source directory matching the extensions mentioned in the updatedList.
I am thinking that mentioning the extension of the files that are already present in the ignore list should suffice, but apparently it does not.
I am currently using Python 2.7
My Imports
import logging
import os
from win32api import GetFileVersionInfo, LOWORD, HIWORD
import zipfile
import shutil
import sys
from os.path import isfile
from distutils import dir_util
import ConfigDTO
import datetime
import UpdateSettings
import time
import win32api
import socket
from shutil import copytree, ignore_patterns
import os
Please help .
Thanks
I get it .. sorry it was my mistake. The document for shutil specifically says that the destination directory must not exist. well in my case , the destination directory was existing earlier and hence i was getting the message.
Thanks