# File and Filesystem Tasks
Tasks for working with files and filesystems.
# Copy
Task for copying files or directories within the file system.
Args:
source_path (Union[str, Path], optional)
: the path to the source directory/file.target_path (Union[str, Path], optional)
: the path to the target directory/file. If copying a directory: thetarget_path
must not exists.**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.files.operations.Copy.run (source_path="", target_path="")[source] |
Task run method.
|
# Glob
This task returns the content of a given directory matching a given pattern within the file system. Args:
path (Union[str, Path], optional)
: directory pathpattern (str, optional)
: glob pattern, defaults to ***kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.files.operations.Glob.run (path="", pattern="*")[source] |
Task run method.
|
# Move
Task for moving files or directories within the file system.
Args:
source_path (Union[str, Path], optional)
: the path to the source directory/file.target_path (Union[str, Path], optional)
: the path to the target directory/file. Any parent directories oftarget_path
must already exist.**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.files.operations.Move.run (source_path="", target_path="")[source] |
Task run method.
|
# Remove
Task for removing files or directories within the file system.
Args:
path (Union[str, Path], optional)
: file or directory to be removed If deleting a directory, the directory must be empty.**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.files.operations.Remove.run (path="")[source] |
Task run method.
|
# Unzip
Task for unzipping data.
Args:
zip_path (Union[str, Path], optional)
: the path to the zip fileextract_dir (Union[str, Path], optional)
: directory to extract the zip file into. If not provided, the current working directory will be used. This directory must already exist.**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.files.compression.Unzip.run (zip_path="", extract_dir="", password=None)[source] |
Task run method.
|
# Zip
class
prefect.tasks.files.compression.Zip
(source_path="", zip_path="", compression_method="deflate", compression_level=None, **kwargs)[source]Task to create a zip archive.
Args:
source_path (Union[str, Path, List[str], List[Path]], optional)
: path or paths to compress into a single zip archive.zip_path (Union[str, Path], optional)
: path to the output archive file. Any parent directories ofzip_path
must already exist.compression_method (str, optional)
: the compression method to use. Options are "deflate", "store", "bzip2", and "lzma". Defaults to"deflate"
.compression_level (int, optional)
: Compression level to use, see https://docs.python.org/3/library/zipfile.html#zipfile.ZipFile for more info. Python 3.7+ only.**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor.
methods: |
---|
prefect.tasks.files.compression.Zip.run (source_path="", zip_path="")[source] |
Task run method.
|
This documentation was auto-generated from commit bd9182e
on July 31, 2024 at 18:02 UTC