• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(941)  |  Call(883)  |  Derive(0)  |  Import(58)
Recursively copy a directory tree using copy2().

The destination directory must not already exist.
If exception(s) occur, an Error is raised with a list of reasons.

If the optional symlinks flag is true, symbolic links in the
source tree result in symbolic links in the destination tree; if
it is false, the contents of the files pointed to by symbolic
links are copied.

The optional ignore argument is a callable. If given, it
is called with the `src` parameter, which is the directory
being visited by copytree(), and `names` which is the list of
`src` contents, as returned by os.listdir():

    callable(src, names) -> ignored_names

Since copytree() is called recursively, the callable will be
called once for each directory that is copied. It returns a
list of names relative to the `src` directory that should
not be copied.

XXX Consider this example code rather than the ultimate tool.

        def copytree(src, dst, symlinks=False, ignore=None):
    """Recursively copy a directory tree using copy2().

    The destination directory must not already exist.
    If exception(s) occur, an Error is raised with a list of reasons.

    If the optional symlinks flag is true, symbolic links in the
    source tree result in symbolic links in the destination tree; if
    it is false, the contents of the files pointed to by symbolic
    links are copied.

    The optional ignore argument is a callable. If given, it
    is called with the `src` parameter, which is the directory
    being visited by copytree(), and `names` which is the list of
    `src` contents, as returned by os.listdir():

        callable(src, names) -> ignored_names

    Since copytree() is called recursively, the callable will be
    called once for each directory that is copied. It returns a
    list of names relative to the `src` directory that should
    not be copied.

    XXX Consider this example code rather than the ultimate tool.

    """
    names = os.listdir(src)
    if ignore is not None:
        ignored_names = ignore(src, names)
    else:
        ignored_names = set()

    os.makedirs(dst)
    errors = []
    for name in names:
        if name in ignored_names:
            continue
        srcname = os.path.join(src, name)
        dstname = os.path.join(dst, name)
        try:
            if symlinks and os.path.islink(srcname):
                linkto = os.readlink(srcname)
                os.symlink(linkto, dstname)
            elif os.path.isdir(srcname):
                copytree(srcname, dstname, symlinks, ignore)
            else:
                # Will raise a SpecialFileError for unsupported file types
                copy2(srcname, dstname)
        # catch the Error from the recursive copytree so that we can
        # continue with other files
        except Error, err:
            errors.extend(err.args[0])
        except EnvironmentError, why:
            errors.append((srcname, dstname, str(why)))
    try:
        copystat(src, dst)
    except OSError, why:
        if WindowsError is not None and isinstance(why, WindowsError):
            # Copying file access times may fail on Windows
            pass
        else:
            errors.extend((src, dst, str(why)))
    if errors:
        raise Error, errors
        


src/p/y/pyobjc-framework-WebKit-2.3/Examples/UsingWebKitNightlyBuilds/rewriteHeaders.py   pyobjc-framework-WebKit(Download)
            shutil.rmtree(os.path.join(outputDir, framework))
 
        shutil.copytree(
                os.path.join(resources, framework),
                os.path.join(outputDir, framework), symlinks=True)
 
        rewriteFrameworksInDirectory(outputDir)

src/e/c/ecell-HEAD/ecell4/trunk/doc/sample/ga/ga.py   ecell(Download)
				aDstDir = "%s%s%s" %(self.theSetting['ELITE DIR'],\
				                     os.sep,\
				                     os.path.basename(aSrcDir[:-len(os.sep)]))
				shutil.copytree(aSrcDir,aDstDir)
 
		# Second generation or after
		else:
					aDstDir = "%s%s%s" %(self.theSetting['ELITE DIR'],\
					                     os.sep,\
				                         os.path.basename(aSrcDir[:-len(os.sep)]))
					shutil.copytree(aSrcDir,aDstDir)
 
 
			# -----------------------------------------------------
		# -----------------------------------------------
		try:
			if os.path.isdir(aDir) == True:
				shutil.copytree(aDir,anOldDir)    # Note:(1)
				shutil.rmtree(aDir)               # Note:(2)
				# Those two lines (1) and (2) should be changed shutil.move()
				# using Python 2.3 or later

src/e/c/ecell-HEAD/ecell3/trunk/doc/samples/ga/ga.py   ecell(Download)
                aDstDir = "%s%s%s" %(self.theSetting['ELITE DIR'],\
                                     os.sep,\
                                     os.path.basename(aSrcDir[:-len(os.sep)]))
                shutil.copytree(aSrcDir,aDstDir)
 
        # Second generation or after
        else:
                    aDstDir = "%s%s%s" %(self.theSetting['ELITE DIR'],\
                                         os.sep,\
                                         os.path.basename(aSrcDir[:-len(os.sep)]))
                    shutil.copytree(aSrcDir,aDstDir)
 
 
            # -----------------------------------------------------
        # -----------------------------------------------
        try:
            if os.path.isdir(aDir) == True:
                shutil.copytree(aDir,anOldDir)    # Note:(1)
                shutil.rmtree(aDir)               # Note:(2)
                # Those two lines (1) and (2) should be changed shutil.move()
                # using Python 2.3 or later

src/c/h/changingsong-HEAD/trunk/samples/plugin_sys/yapsy/yapsy/AutoInstallPluginManager.py   changingsong(Download)
			return False
		if os.path.isdir(plugin_info.path):
			try:
				shutil.copytree(plugin_info.path,
								os.path.join(self.install_dir,os.path.basename(plugin_info.path)))
				shutil.copy(os.path.join(directory, plugin_info_filename),
							self.install_dir)

src/c/h/changingsong-HEAD/samples/plugin_sys/yapsy/yapsy/AutoInstallPluginManager.py   changingsong(Download)
			return False
		if os.path.isdir(plugin_info.path):
			try:
				shutil.copytree(plugin_info.path,
								os.path.join(self.install_dir,os.path.basename(plugin_info.path)))
				shutil.copy(os.path.join(directory, plugin_info_filename),
							self.install_dir)

src/n/o/notmm-0.4.1/examples/lib/satchmo_store/shop/management/commands/satchmo_copy_static.py   notmm(Download)
        if os.path.exists(static_dest):
            print "Static directory exists. You must manually copy the files you need."
        else:
            shutil.copytree(static_src, static_dest)
            for root, dirs, files in os.walk(static_dest):
                if '.svn' in dirs:
                    shutil.rmtree(os.path.join(root,'.svn'), True)

src/p/y/python-xmp-toolkit-HEAD/test/samples.py   python-xmp-toolkit(Download)
def make_temp_samples():
	global sampledir
	if os.path.exists( sampledir ):
		remove_temp_samples()
 
	shutil.copytree('samples', sampledir)
 

src/t/o/topographica-HEAD/releases/0.9.7/topographica/topo/misc/genexamples.py   topographica(Download)
        print "Creating %s"%locn
        import shutil
        print "Copying %s to %s"%(examples,locn)
        shutil.copytree(examples,locn)
 
 
def print_examples_dir(**kw):

src/t/o/topographica-HEAD/topographica/topo/misc/genexamples.py   topographica(Download)
        print "Creating %s"%locn
        import shutil
        print "Copying %s to %s"%(examples,locn)
        shutil.copytree(examples,locn)
 
 
def print_examples_dir(**kw):

src/t/o/topographica-0.9.7/topo/misc/genexamples.py   topographica(Download)
        print "Creating %s"%locn
        import shutil
        print "Copying %s to %s"%(examples,locn)
        shutil.copytree(examples,locn)
 
 
def print_examples_dir(**kw):

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next