GeoEco.DataManagement.Directories.Directory.Copy

classmethod Directory.Copy(sourceDirectory, destinationDirectory, deleteExistingDestinationDirectory=False, overwriteExistingFiles=False)

Copies a directory, including its subdirectories and files.

Parameters:
  • sourceDirectory (str) – Directory to copy. The directory may contain subdirectories and files. Other types of file system objects, such as symbolic links, are not allowed. Minimum length꞉ 1. Must exist.

  • destinationDirectory (str) – Copy to create. Missing directories in this path will be created if they do not exist. Minimum length꞉ 1. Must be different than sourceDirectory.

  • deleteExistingDestinationDirectory (bool, optional) – This parameter is ignored if the destination directory does not already exist. If True, the existing destination directory, including all subdirectories and files, will be deleted and replaced with the source directory. If False, the destination directory will not be deleted first, and the files in the source directory (and all subdirectories) will be copied into the existing destination directory.

  • overwriteExistingFiles (bool, optional) – If True, destination files will be overwritten, if they exist. If False, a ValueError will be raised if any destination file exists. This parameter is ignored if deleteExistingDestinationDirectory is True, since that parameter will cause any existing files to be deleted.