Python shutil.ignore_patterns() Examples

The following are 30 code examples of shutil.ignore_patterns(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module shutil , or try the search function .
Example #1
Source Project: OP_Manager   Author: adwuard   File: file_util.py    License: MIT License 6 votes vote down vote up
def copytree(src, dst, symlinks=False, ignore=shutil.ignore_patterns('.*', '_*')):
    """
    Copy Entire Folder
    :param src: source path
    :param dst: destination path
    :param symlinks: optional
    :param ignore: pass shutil.ignore_patterns('.*', '_*')
    :return:
    """
    for item in os.listdir(src):
        s = os.path.join(src, item)
        d = os.path.join(dst, item)
        if os.path.isdir(s):
            shutil.copytree(s, d, symlinks, ignore)
        else:
            shutil.copy2(s, d) 
Example #2
Source Project: gltf-blender-importer   Author: ksons   File: make_package.py    License: MIT License 6 votes vote down vote up
def make_package(suffix=None):
    this_dir = os.path.dirname(os.path.abspath(__file__))
    dist_dir = os.path.join(this_dir, 'dist')

    if not os.path.exists(dist_dir):
        os.makedirs(dist_dir)

    with tempfile.TemporaryDirectory() as tmpdir:
        shutil.copytree(
            os.path.join(this_dir, 'addons', 'io_scene_gltf_ksons'),
            os.path.join(tmpdir, 'io_scene_gltf_ksons'),
            ignore=shutil.ignore_patterns('__pycache__'))

        zip_name = 'io_scene_gltf_ksons'
        if suffix:
            zip_name += '-' + suffix

        shutil.make_archive(
            os.path.join('dist', zip_name),
            'zip',
            tmpdir) 
Example #3
Source Project: coa_tools   Author: ndee85   File: addon_updater.py    License: GNU General Public License v3.0 6 votes vote down vote up
def create_backup(self):
        if self._verbose: print("Backing up current addon folder")
        local = os.path.join(self._updater_path,"backup")
        tempdest = os.path.join(self._addon_root,
                        os.pardir,
                        self._addon+"_updater_backup_temp")

        if os.path.isdir(local) == True:
            shutil.rmtree(local)
        if self._verbose: print("Backup destination path: ",local)

        # make the copy
        if self._backup_ignore_patterns != None:
            shutil.copytree(
                self._addon_root,tempdest,
                ignore=shutil.ignore_patterns(*self._backup_ignore_patterns))
        else:
            shutil.copytree(self._addon_root,tempdest)
        shutil.move(tempdest,local)

        # save the date for future ref
        now = datetime.now()
        self._json["backup_date"] = "{m}-{d}-{yr}".format(
                m=now.strftime("%B"),d=now.day,yr=now.year)
        self.save_updater_json() 
Example #4
Source Project: octavia   Author: openstack   File: osutils.py    License: Apache License 2.0 6 votes vote down vote up
def create_netns_dir(
            self, network_dir=None, netns_network_dir=None, ignore=None):
        if not netns_network_dir:
            netns_network_dir = self.get_netns_network_dir()
        if not network_dir:
            network_dir = self.get_network_path()
        if not ignore:
            ignore = shutil.ignore_patterns('ifcfg-eth0*', 'ifcfg-lo*')
        super(RH, self).create_netns_dir(
            network_dir, netns_network_dir, ignore)

        # Copy /etc/sysconfig/network file
        src = '/etc/sysconfig/network'
        dst = '/etc/netns/{netns}/sysconfig'.format(
            netns=consts.AMPHORA_NAMESPACE)
        shutil.copy2(src, dst) 
Example #5
Source Project: Dallinger   Author: Dallinger   File: deployment.py    License: MIT License 6 votes vote down vote up
def exclusion_policy():
    """Returns a callable which, when passed a directory path and a list
    of files in that directory, will return a subset of the files which should
    be excluded from a copy or some other action.

    See https://docs.python.org/3/library/shutil.html#shutil.ignore_patterns
    """
    patterns = set(
        [
            ".git",
            "config.txt",
            "*.db",
            "*.dmg",
            "node_modules",
            "snapshots",
            "data",
            "server.log",
            "__pycache__",
        ]
    )

    return shutil.ignore_patterns(*patterns) 
Example #6
Source Project: renku-python   Author: SwissDataScienceCenter   File: setup.py    License: Apache License 2.0 6 votes vote down vote up
def run(self):
        from renku.core.commands.init import fetch_template, \
            read_template_manifest

        with TemporaryDirectory() as tempdir:
            # download and extract template data
            temppath = Path(tempdir)
            print('downloading Renku templates...')
            fetch_template(URL, REFERENCE, temppath)
            read_template_manifest(temppath, checkout=True)

            # copy templates
            current_path = Path.cwd()
            template_path = current_path / 'renku' / 'templates'
            if template_path.exists():
                shutil.rmtree(str(template_path))
            shutil.copytree(
                str(temppath),
                str(template_path),
                ignore=shutil.ignore_patterns('.git')
            ) 
Example #7
Source Project: Uranium   Author: Ultimaker   File: Resources.py    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
def copyVersionFolder(cls, src_path: str, dest_path: str) -> None:
        Logger.log("i", "Copying directory from '%s' to '%s'", src_path, dest_path)
        # we first copy everything to a temporary folder, and then move it to the new folder
        base_dir_name = os.path.basename(src_path)
        temp_root_dir_path = tempfile.mkdtemp("cura-copy")
        temp_dir_path = os.path.join(temp_root_dir_path, base_dir_name)
        # src -> temp -> dest
        try:
            # Copy everything, except for the logs, lock or really old (we used to copy old configs to the "old" folder)
            # config files.
            shutil.copytree(src_path, temp_dir_path,
                            ignore = shutil.ignore_patterns("*.lock", "*.log", "*.log.?", "old"))
            # if the dest_path exist, it needs to be removed first
            if not os.path.exists(dest_path):
                shutil.move(temp_dir_path, dest_path)
            else:
                Logger.log("e", "Unable to copy files to %s as the folder already exists", dest_path)
        except:
            Logger.log("e", "Something occurred when copying the version folder from '%s' to '%s'", src_path, dest_path) 
Example #8
Source Project: build-calibre   Author: kovidgoyal   File: __init__.py    License: GNU General Public License v3.0 6 votes vote down vote up
def add_qt_framework(self, f):
        libname = f
        f = f + '.framework'
        src = join(PREFIX, 'qt', 'lib', f)
        ignore = shutil.ignore_patterns('Headers', '*.h', 'Headers/*')
        dest = join(self.frameworks_dir, f)
        shutil.copytree(src, dest, symlinks=True,
                        ignore=ignore)
        lib = os.path.realpath(join(dest, libname))
        rpath = os.path.relpath(lib, self.frameworks_dir)
        self.set_id(lib, self.FID + '/' + rpath)
        self.fix_dependencies_in_lib(lib)
        # The following is needed for codesign in OS X >= 10.9.5
        # The presence of the .prl file in the root of the framework causes
        # codesign to fail.
        with current_dir(dest):
            for x in os.listdir('.'):
                if x != 'Versions' and not os.path.islink(x):
                    os.remove(x) 
Example #9
Source Project: fplutil   Author: google   File: push_package.py    License: Apache License 2.0 6 votes vote down vote up
def create_mirror(self, mirror_dir):
    """Create mirror of this package and it's dependencies.

    Args:
      mirror_dir: Directory where mirror will be stored.

    Raises:
      OSError: If this method fails to create mirror.
    """
    ignore_git = shutil.ignore_patterns('.git')
    logging.debug('Copying %s to %s', self.path, mirror_dir)
    shutil.copytree(self.path, mirror_dir, ignore=ignore_git)
    dependencies_dir = os.path.join(mirror_dir, 'dependencies')
    logging.debug('Creating ' + dependencies_dir)
    os.mkdir(dependencies_dir)
    for dependency in self.dependencies:
      mirrored_dependency = os.path.join(dependencies_dir, dependency.name)
      logging.debug('Copying %s to %s ', dependency.path, mirrored_dependency)
      shutil.copytree(dependency.path, mirrored_dependency, ignore=ignore_git) 
Example #10
Source Project: Amipy   Author: 01ly   File: file.py    License: MIT License 6 votes vote down vote up
def copy_files(src,dst,ignore_pattern,make=True,render=None,strips='.tpl'):
    if not check_path(src):
        raise PathDoesntExist
    if not check_path(dst,make):
        raise PathDoesntExist
    src_files = os.listdir(src)
    ignore_fun = shutil.ignore_patterns(*ignore_pattern)
    filter_matches = ignore_fun(src,src_files)
    for file in src_files:
        if file in filter_matches:
            continue
        srcname = os.path.join(src,file)
        dstname = os.path.join(dst,file.rstrip(strips))
        if os.path.isdir(srcname):
            copy_files(srcname,dstname,ignore_pattern)
        else:
            shutil.copy2(srcname,dstname)
            if render:
                if file in render:
                    _var = render[file]
                    render_template(srcname,dstname,_var) 
Example #11
Source Project: kitty   Author: kovidgoyal   File: init_env.py    License: GNU General Public License v3.0 6 votes vote down vote up
def build_c_extensions(ext_dir, args):
    writeable_src_dir = os.path.join(ext_dir, 'src')
    shutil.copytree(
        KITTY_DIR, writeable_src_dir, symlinks=True,
        ignore=shutil.ignore_patterns('b', 'build', 'dist', '*_commands.json', '*.o'))
    cmd = [PYTHON, 'setup.py']
    bundle = 'macos-freeze' if ismacos else 'linux-freeze'
    cmd.append(bundle)
    dest = kitty_constants['appname'] + ('.app' if ismacos else '')
    dest = os.path.join(ext_dir, dest)
    cmd += ['--prefix', dest]
    if run(*cmd, cwd=writeable_src_dir) != 0:
        print('Building of kitty package failed', file=sys.stderr)
        os.chdir(KITTY_DIR)
        run_shell()
        raise SystemExit('Building of kitty package failed')
    return ext_dir 
Example #12
Source Project: hvplot   Author: holoviz   File: setup.py    License: BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def examples(path='hvplot-examples', verbose=False, force=False, root=__file__):
    """
    Copies the notebooks to the supplied path.
    """
    filepath = os.path.abspath(os.path.dirname(root))
    example_dir = os.path.join(filepath, './examples')
    if not os.path.exists(example_dir):
        example_dir = os.path.join(filepath, '../examples')
    if os.path.exists(path):
        if not force:
            print('%s directory already exists, either delete it or set the force flag' % path)
            return
        shutil.rmtree(path)
    ignore = shutil.ignore_patterns('.ipynb_checkpoints', '*.pyc', '*~')
    tree_root = os.path.abspath(example_dir)
    if os.path.isdir(tree_root):
        shutil.copytree(tree_root, path, ignore=ignore, symlinks=True)
    else:
        print('Cannot find %s' % tree_root) 
Example #13
Source Project: eval-nas   Author: kcyu2014   File: utils.py    License: MIT License 6 votes vote down vote up
def create_exp_dir(path, scripts_to_save=None):
    if not os.path.exists(path):
        os.makedirs(path, exist_ok=True)

    print('Experiment dir : {}'.format(path))
    if scripts_to_save is not None:
        try:
            os.mkdir(os.path.join(path, 'scripts'))
        except FileExistsError as e:
            logging.warning('Deleting all the previously stored scripts...')
            shutil.rmtree(os.path.join(path, 'scripts'))
            os.mkdir(os.path.join(path, 'scripts'))

        for script in scripts_to_save:
            dst_file = os.path.join(path, 'scripts', os.path.basename(script))
            if os.path.isdir(script):
                shutil.copytree(script, dst_file, ignore=shutil.ignore_patterns('*.pyc', 'tmp*', '*.ipynb'))
            else:
                shutil.copyfile(script, dst_file) 
Example #14
Source Project: mbuild   Author: intelxed   File: util.py    License: Apache License 2.0 6 votes vote down vote up
def copy_tree(src,tgt, ignore_patterns=None, symlinks=False):
    """Copy the tree at src to tgt. This will first remove tgt if it
    already exists."""
    if verbose(1):
        msgb("COPYTREE", tgt + " <- " + src)
    if not os.path.exists(src):
        error_msg("SRC TREE DOES NOT EXIST", src)
        raise Exception
    if os.path.exists(tgt):
        if verbose(1):
            msgb("Removing existing target tree", tgt)
        shutil.rmtree(tgt, ignore_errors=True)
    if verbose(1):
        msgb("Copying to tree", tgt)
    if ignore_patterns:
        sp = shutil.ignore_patterns(ignore_patterns)
    else:
        sp = None
    shutil.copytree(src,tgt,ignore=sp, symlinks=symlinks)
    if verbose(1):
        msgb("Done copying tree", tgt) 
Example #15
Source Project: rpmvenv   Author: kevinconway   File: rpmbuild.py    License: MIT License 6 votes vote down vote up
def copy_source(top, source, name=None):
    """Copy the source directory into the SOURCES directory.

    Args:
        top: The absolute path to the %_topdir.
        source: The absolute path to the source directory.
        name: The name of the directory to place in SOURCES.

    Returns:
        The absolute path to the copy.
    """
    name = name or os.path.basename(source)
    path = os.path.join(top, 'SOURCES', name)
    shutil.copytree(
        source,
        path,
        ignore=shutil.ignore_patterns(*IGNORED_PATTERNS),
    )
    return path 
Example #16
Source Project: sigir19-neural-ir   Author: sebastian-hofstaetter   File: utils.py    License: Apache License 2.0 6 votes vote down vote up
def prepare_experiment(args, config):
    if args.run_folder is not None:
        run_folder = args.run_folder
    else:
        run_folder = prepare_experiment_folder(config["expirement_base_path"], args.run_name)
    #
    # saved uased config (with overwrites)
    #     
    save_config(os.path.join(run_folder,"config.yaml"),config)

    #
    # copy source code of matchmaker
    #
    dir_path = os.path.dirname(os.path.realpath(__file__))

    shutil.copytree(dir_path, os.path.join(run_folder,"matchmaker-src"), ignore=shutil.ignore_patterns("__pycache__"))

    return run_folder 
Example #17
Source Project: holoviews   Author: holoviz   File: __init__.py    License: BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def examples(path='holoviews-examples', verbose=False, force=False, root=__file__):
    """
    Copies the notebooks to the supplied path.
    """
    filepath = os.path.abspath(os.path.dirname(root))
    example_dir = os.path.join(filepath, './examples')
    if not os.path.exists(example_dir):
        example_dir = os.path.join(filepath, '../examples')
    if os.path.exists(path):
        if not force:
            print('%s directory already exists, either delete it or set the force flag' % path)
            return
        shutil.rmtree(path)
    ignore = shutil.ignore_patterns('.ipynb_checkpoints','*.pyc','*~')
    tree_root = os.path.abspath(example_dir)
    if os.path.isdir(tree_root):
        shutil.copytree(tree_root, path, ignore=ignore, symlinks=True)
    else:
        print('Cannot find %s' % tree_root) 
Example #18
Source Project: transformer-kernel-ranking   Author: sebastian-hofstaetter   File: utils.py    License: Apache License 2.0 6 votes vote down vote up
def prepare_experiment(args, config):
    #if args.run_folder is not None:
    #    run_folder = args.run_folder
    #else:
    run_folder = prepare_experiment_folder(config["expirement_base_path"], args.run_name)
    #
    # saved uased config (with overwrites)
    #     
    save_config(os.path.join(run_folder,"config.yaml"),config)

    #
    # copy source code of matchmaker
    #
    dir_path = os.path.dirname(os.path.realpath(__file__))

    shutil.copytree(dir_path, os.path.join(run_folder,"matchmaker-src"), ignore=shutil.ignore_patterns("__pycache__"))

    return run_folder 
Example #19
Source Project: mantra   Author: RJT1990   File: launch.py    License: Apache License 2.0 6 votes vote down vote up
def handle(self, args, unknown):
        """
        Creates a new project directory based on the name and template given by the user; configures the project
        """

        project_name = args.project_name

        library_path = '/'.join(os.path.realpath(__file__).split('/')[:-4])
        default_template_path = '%s/templates/projects/default' % library_path

        top_dir = os.path.join(os.getcwd(), project_name)
        
        # copy the project template to the path the user specified
        try:
            shutil.copytree(default_template_path, top_dir, ignore=shutil.ignore_patterns('*.pyc', '__pycache__*'))
        except FileExistsError:
            raise Exception("'%s' folder exists already" % top_dir)
        except OSError as e:
            raise Exception(e)

        self.configure_project(project_name, top_dir) 
Example #20
Source Project: Gerapy   Author: Gerapy   File: utils.py    License: MIT License 6 votes vote down vote up
def copy_tree(src, dst):
    """
    copy tree
    :param src:
    :param dst:
    :return:
    """
    ignore = ignore_patterns(*IGNORES)
    names = os.listdir(src)
    ignored_names = ignore(src, names)
    if not os.path.exists(dst):
        os.makedirs(dst)
    
    for name in names:
        if name in ignored_names:
            continue
        
        src_name = os.path.join(src, name)
        dst_name = os.path.join(dst, name)
        if os.path.isdir(src_name):
            copy_tree(src_name, dst_name)
        else:
            copy2(src_name, dst_name)
    copystat(src, dst) 
Example #21
Source Project: icnn   Author: locuslab   File: runtime_env.py    License: Apache License 2.0 6 votes vote down vote up
def run(main, outdir):
    script = os.path.abspath(sys.modules['__main__'].__file__)
    scriptdir, scriptfile = os.path.split(script)

    if not os.path.exists(outdir):
        os.makedirs(outdir)

    print("outdir: " + outdir)

    if FLAGS.copy:
        shutil.copytree(run_folder, path, symlinks=True, ignore=shutil.ignore_patterns('.*'))

    Executor(main, outdir).execute()


# register clean up before anybody else does 
Example #22
Source Project: octavia   Author: openstack   File: osutils.py    License: Apache License 2.0 5 votes vote down vote up
def create_netns_dir(
            self, network_dir=None, netns_network_dir=None, ignore=None):
        if not netns_network_dir:
            netns_network_dir = self.get_netns_network_dir()
        if not network_dir:
            network_dir = self.get_network_path()
        if not ignore:
            ignore = shutil.ignore_patterns('eth0*', 'openssh*')
        super(Ubuntu, self).create_netns_dir(
            network_dir, netns_network_dir, ignore) 
Example #23
Source Project: octavia   Author: openstack   File: test_osutils.py    License: Apache License 2.0 5 votes vote down vote up
def test_create_netns_dir(self, mock_copytree, mock_makedirs, mock_copy2):
        network_dir = 'foo'
        netns_network_dir = 'fake_netns_network'
        ignore = shutil.ignore_patterns('fake_eth*', 'fake_loopback*')
        self.rh_os_util.create_netns_dir(network_dir,
                                         netns_network_dir,
                                         ignore)
        mock_copytree.assert_any_call(
            network_dir,
            os.path.join('/etc/netns/',
                         consts.AMPHORA_NAMESPACE,
                         netns_network_dir),
            ignore=ignore,
            symlinks=True)

        mock_makedirs.assert_any_call(os.path.join('/etc/netns/',
                                                   consts.AMPHORA_NAMESPACE))
        mock_copy2.assert_any_call(
            '/etc/sysconfig/network',
            '/etc/netns/{netns}/sysconfig'.format(
                netns=consts.AMPHORA_NAMESPACE))

        mock_copytree.reset_mock()
        mock_makedirs.reset_mock()
        mock_copy2.reset_mock()

        self.ubuntu_os_util.create_netns_dir(network_dir,
                                             netns_network_dir,
                                             ignore)
        mock_copytree.assert_any_call(
            network_dir,
            os.path.join('/etc/netns/',
                         consts.AMPHORA_NAMESPACE,
                         netns_network_dir),
            ignore=ignore,
            symlinks=True)

        mock_makedirs.assert_any_call(os.path.join('/etc/netns/',
                                                   consts.AMPHORA_NAMESPACE))
        mock_copy2.assert_not_called() 
Example #24
Source Project: marvin-python-toolbox   Author: marvin-ai   File: pkg.py    License: Apache License 2.0 5 votes vote down vote up
def copy(src, dest, ignore=('.git', '.pyc', '__pycache__')):
    try:
        shutil.copytree(src, dest, ignore=shutil.ignore_patterns(*ignore))
    except OSError as e:
        if e.errno == errno.ENOTDIR:
            shutil.copy(src, dest)
        else:
            print('Directory not copied. Error: %s' % e) 
Example #25
Source Project: Airtest   Author: AirtestProject   File: report.py    License: Apache License 2.0 5 votes vote down vote up
def _make_export_dir(self):
        """mkdir & copy /staticfiles/screenshots"""
        # let dirname = <script name>.log
        dirname = self.script_name.replace(os.path.splitext(self.script_name)[1], ".log")
        # mkdir
        dirpath = os.path.join(self.export_dir, dirname)
        if os.path.isdir(dirpath):
            shutil.rmtree(dirpath, ignore_errors=True)

        # copy script
        def ignore_export_dir(dirname, filenames):
            # 忽略当前导出的目录,防止递归导出
            if os.path.commonprefix([dirpath, dirname]) == dirpath:
                return filenames
            return []
        self.copy_tree(self.script_root, dirpath, ignore=ignore_export_dir)
        # copy log
        logpath = os.path.join(dirpath, LOGDIR)
        if os.path.normpath(logpath) != os.path.normpath(self.log_root):
            if os.path.isdir(logpath):
                shutil.rmtree(logpath, ignore_errors=True)
            self.copy_tree(self.log_root, logpath, ignore=shutil.ignore_patterns(dirname))
        # if self.static_root is not a http server address, copy static files from local directory
        if not self.static_root.startswith("http"):
            for subdir in ["css", "fonts", "image", "js"]:
                self.copy_tree(os.path.join(self.static_root, subdir), os.path.join(dirpath, "static", subdir))

        return dirpath, logpath 
Example #26
Source Project: streamalert   Author: airbnb   File: package.py    License: Apache License 2.0 5 votes vote down vote up
def _copy_files(self, paths, ignores=None):
        """Copy all files and folders into temporary package path

        Args:
            paths (list): Paths of folders to be copied into the Lambda package
            ignores (set=None): File globs to be ignored during the copying of files in paths
        """
        for path in paths:
            # Copy the directory, skipping any files explicitly ignored
            kwargs = {'ignore': shutil.ignore_patterns(*ignores)} if ignores else dict()
            shutil.copytree(path, os.path.join(self.temp_package_path, path), **kwargs) 
Example #27
Source Project: blenderseed   Author: appleseedhq   File: blenderseed.package.py    License: MIT License 5 votes vote down vote up
def deploy_blenderseed_to_stage(self):
        progress("Deploying blenderseed to staging directory")
        shutil.copytree(self.settings.root_dir, "blenderseed", ignore=shutil.ignore_patterns("scripts")) 
Example #28
Source Project: imperialism-remake   Author: Trilarion   File: build_documentation.py    License: GNU General Public License v3.0 5 votes vote down vote up
def copy_manual(source, target):
    """

    :param source:
    :param target:
    :return:
    """

    # delete target if existing
    if os.path.exists(target):
        shutil.rmtree(target)

    # copy manual
    shutil.copytree(source, target, ignore=shutil.ignore_patterns('.*')) 
Example #29
Source Project: dan   Author: salu133445   File: utils.py    License: MIT License 5 votes vote down vote up
def backup_src(dst):
    """Backup the source code."""
    if os.path.exists(dst):
        shutil.rmtree(dst)
    shutil.copytree(
        os.path.dirname(os.path.dirname(os.path.realpath(__file__))), dst,
        ignore=shutil.ignore_patterns('__pycache__'))

# --- Parameter file and dictionary utilities ---------------------------------- 
Example #30
Source Project: WebWhatsapp-Wrapper   Author: mukulhase   File: __init__.py    License: MIT License 5 votes vote down vote up
def save_firefox_profile(self, remove_old=False):
        """Function to save the firefox profile to the permanant one"""
        self.logger.info(
            "Saving profile from %s to %s" % (self._profile.path, self._profile_path)
        )

        if remove_old:
            if os.path.exists(self._profile_path):
                try:
                    shutil.rmtree(self._profile_path)
                except OSError:
                    pass

            shutil.copytree(
                os.path.join(self._profile.path),
                self._profile_path,
                ignore=shutil.ignore_patterns("parent.lock", "lock", ".parentlock"),
            )
        else:
            for item in os.listdir(self._profile.path):
                if item in ["parent.lock", "lock", ".parentlock"]:
                    continue
                s = os.path.join(self._profile.path, item)
                d = os.path.join(self._profile_path, item)
                if os.path.isdir(s):
                    shutil.copytree(
                        s,
                        d,
                        ignore=shutil.ignore_patterns(
                            "parent.lock", "lock", ".parentlock"
                        ),
                    )
                else:
                    shutil.copy2(s, d)

        with open(os.path.join(self._profile_path, self._LOCAL_STORAGE_FILE), "w") as f:
            f.write(dumps(self.get_local_storage()))