I've been trying to use "copytree(src,dst)", however I couldn't since the destination folder should exists at all.Here you can see the small piece of code I wrote:
def copy_dir(src,dest):
import shutil
shutil.copytree(src,dest)
copy_dir('C:/crap/chrome/','C:/test/')
and this is the error I m getting as I expected...
Traceback (most recent call last):
File "C:\Documents and Settings\Administrator\workspace\MMS-Auto\copy.py", line 5, in <module>
copy_dir('C:/crap/chrome/','C:/test/')
File "C:\Documents and Settings\Administrator\workspace\MMS-Auto\copy.py", line 3, in copy_dir
shutil.copytree(src,dest)
File "C:\Python27\lib\shutil.py", line 174, in copytree
os.makedirs(dst)
File "C:\Python27\lib\os.py", line 157, in makedirs
mkdir(name, mode)
WindowsError: [Error 183] Cannot create a file when that file already exists: 'C:/test/'
Here is my question is there a way I could achieve the same result without creating my own copytree function?
Thank you in advance.