Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(3)  |  Derive(0)  |  Import(1)
Copy `src` to `dst` or copy `files` to `dst`

Copy a file or folder to a different file/folder
If no `src` file is specified, will attempt to copy `files` to `dst`

*Notice*, elements of `files` will not be expanded before copying.

:param src: source directory or file
:param dst: destination file or folder (in the case of `files`)
:param files: list of files (strings) to copy to `src`

        def cp(src="", dst="", files=None):
    """Copy `src` to `dst` or copy `files` to `dst`

    Copy a file or folder to a different file/folder
    If no `src` file is specified, will attempt to copy `files` to `dst`

    *Notice*, elements of `files` will not be expanded before copying.

    :param src: source directory or file
    :param dst: destination file or folder (in the case of `files`)
    :param files: list of files (strings) to copy to `src`
    """
    assert dst and src or len(files) > 0
    LOGGER.info("Copying %s to %s", src, dst)
    def copy(source, destination):
        """Copy file or folder to destination.

        Depending on the type of source, call the appropriate method
        """
        if os.path.isdir(source):
            shutil.copytree(source, destination)
        else:
            shutil.copy2(source, destination)
    if src:
        copy(src, dst)
    else:
        for file_to_copy in files:
            copy(file_to_copy, dst)
        


src/x/n/Xnt-0.6.3/xnt/__init__.py   Xnt(Download)
VERBOSE = False
 
from xnt.tasks import cp
from xnt.tasks import mv
from xnt.tasks import mkdir

src/x/n/Xnt-0.6.3/xnt/tests/taskcopytests.py   Xnt(Download)
    def test_cp(self):
        """Test default use of cp"""
        xnt.tasks.cp("temp/testfolder1", "temp/testfolder2")
        self.assertTrue(os.path.exists("temp/testfolder2"))
        self.assertTrue(os.path.exists("temp/testfolder1"))
        xnt.tasks.cp("temp/testfile1", "temp/testfile5")
    def test_cp_filelist(self):
        """Test filelist copy"""
        xnt.tasks.cp(dst="temp/testfolder2",
                     files=["temp/testfile1",
                            "temp/testfile2",