Skip to content

Filecopy

flowtask.components.FileCopy

FileCopy

FileCopy(loop=None, job=None, stat=None, **kwargs)

Bases: FileBase

FileCopy

Overview

Copies files from a source directory to a destination directory.

Properties (inherited from FileBase)

.. table:: Properties :widths: auto

+--------------------+----------+-----------+-------------------------------------------------------------------+
| Name               | Required | Summary                                                                       |
+--------------------+----------+-----------+-------------------------------------------------------------------+
| create_destination |   No     | Boolean flag indicating whether to create the destination                     |
|                    |          | directory if it doesn't exist (default: True).                                |
+--------------------+----------+-----------+-------------------------------------------------------------------+
| source             |   Yes    | A dictionary specifying the source directory and filename.                    |
|                    |          | (e.g., {"directory": "/path/to/source", "filename": "myfile.txt"})            |
+--------------------+----------+-----------+-------------------------------------------------------------------+
| destination        |   Yes    | A dictionary specifying the destination directory and optionally filename.    |
|                    |          | (e.g., {"directory": "/path/to/destination", "filename": "renamed_file.txt"}) |
+--------------------+----------+-----------+-------------------------------------------------------------------+
| rename             |   No     | Boolean flag indicating if the file have a new name                           |
+--------------------+----------+-----------+-------------------------------------------------------------------+
| remove_source      |   No     | Boolean flag indicating whether to remove the source file(s) after            |
|                    |          | copying (default: False).                                                     |
+--------------------+----------+-----------+-------------------------------------------------------------------+



Example:

```yaml
FileCopy:
  source:
    filename: '*.xlsx'
    directory: /home/ubuntu/symbits/bose/stores/
  remove_source: true
  destination:
    directory: /home/ubuntu/symbits/bose/stores/backup/
```

close async

close()

Method.

run async

run()

Delete File(s).

start async

start(**kwargs)

Check for File and Directory information.