#NEWLINE# def command_copytree( args ) : #NEWLINE# #INDENT# "\n    Copy one or more source directory(s) below a destination directory.\n    Parts of the destination directory path are created if needed.\n    Similar to the UNIX command: 'cp -R srcdir destdir'\n    " #NEWLINE# for srcdir in args . srcdirs : #NEWLINE# #INDENT# basename = os . path . basename ( srcdir ) #NEWLINE# destdir2 = os . path . normpath ( os . path . join ( destdir2 . destdir , basename ) ) #NEWLINE# if os . path . exists ( destdir2 ) : #NEWLINE# #INDENT# shutil . rmtree ( destdir2 ) #NEWLINE# #UNINDENT# sys . stdout . write ( ( 'copytree: %s => %s\n' % ( srcdir , destdir2 ) ) ) #NEWLINE# shutil . copytree ( srcdir , destdir2 ) #NEWLINE# #UNINDENT# return 0