Beispiel #1
0
 def copyInsideDir(self,
                   r_dir_src,
                   r_dir_dest,
                   overwrite=True,
                   progressBar=None):
     """
     Copy the content a directory to a new location
     """
     dir_src = xbmc.makeLegalFilename(r_dir_src)
     dir_dest = xbmc.makeLegalFilename(r_dir_dest)
     list_dir = os.listdir(dir_src)
     for file in list_dir:
         src = os.path.join(dir_src, file)
         dst = os.path.join(dir_dest, file)
         if os.path.isfile(src):
             if not os.path.isdir(os.path.dirname(dst)):
                 os.makedirs(os.path.dirname(dst))
             if not overwrite and os.path.isfile(dst):
                 os.unlink(dst)
             shutil2.copyfile(src,
                              dst,
                              overwrite=overwrite,
                              progressBar=progressBar,
                              curPercent=100)
         elif os.path.isdir(src):
             if not overwrite and os.path.isdir(dst):
                 shutil2.rmtree(dst)
             shutil2.copytree(src,
                              dst,
                              overwrite=overwrite,
                              progressBar=progressBar,
                              curPercent=100)
Beispiel #2
0
def copy_inside_dir(dirname,
                    destination,
                    overwrite=True,
                    progressBar=None,
                    percentage=100):
    list_dir = os.listdir(dirname)
    for file in list_dir:
        src = os.path.join(dirname, file)
        dst = os.path.join(destination, file)
        if os.path.isfile(src):
            if not os.path.isdir(os.path.dirname(dst)):
                os.makedirs(os.path.dirname(dst))
            if not overwrite and os.path.isfile(dst):
                os.unlink(dst)
            shutil2.copyfile(src,
                             dst,
                             overwrite=overwrite,
                             progressBar=progressBar,
                             percentage=percentage)
        elif os.path.isdir(src):
            if not overwrite and os.path.isdir(dst):
                shutil2.rmtree(dst)
            shutil2.copytree(src,
                             dst,
                             overwrite=overwrite,
                             progressBar=progressBar,
                             percentage=percentage)
Beispiel #3
0
def copy_inside_dir( dirname, destination, overwrite=True, progressBar=None, percentage=100 ):
    list_dir = os.listdir( dirname )
    for file in list_dir:
        src = os.path.join( dirname, file )
        dst = os.path.join( destination, file )
        if os.path.isfile( src ):
            if not os.path.isdir( os.path.dirname( dst ) ):
                os.makedirs( os.path.dirname( dst ) )
            if not overwrite and os.path.isfile( dst ):
                os.unlink( dst )
            shutil2.copyfile( src, dst, overwrite=overwrite, progressBar=progressBar, percentage=percentage )
        elif os.path.isdir( src ):
            if not overwrite and os.path.isdir( dst ):
                shutil2.rmtree( dst )
            shutil2.copytree( src, dst, overwrite=overwrite, progressBar=progressBar, percentage=percentage )
Beispiel #4
0
 def copyInsideDir(self, r_dir_src, r_dir_dest, overwrite=True, progressBar=None):
     """
     Copy the content a directory to a new location
     """
     dir_src = xbmc.makeLegalFilename(r_dir_src)
     dir_dest = xbmc.makeLegalFilename(r_dir_dest)
     list_dir = os.listdir(dir_src)
     for file in list_dir:
         src = os.path.join(dir_src, file)
         dst = os.path.join(dir_dest, file)
         if os.path.isfile(src):
             if not os.path.isdir(os.path.dirname(dst)):
                 os.makedirs(os.path.dirname(dst))
             if not overwrite and os.path.isfile(dst):
                 os.unlink(dst)
             shutil2.copyfile(src, dst, overwrite=overwrite, progressBar=progressBar, curPercent=100)
         elif os.path.isdir(src):
             if not overwrite and os.path.isdir(dst):
                 shutil2.rmtree(dst)
             shutil2.copytree(src, dst, overwrite=overwrite, progressBar=progressBar, curPercent=100)