Skip to content

File Operations

Copy, move, and delete files.

3 modules

ModuleDescription
Sao chép tệpSao chép tệp sang vị trí khác
Xóa tệpXóa tệp khỏi hệ thống tệp
Di chuyển tệpDi chuyển hoặc đổi tên tệp

Modules

Sao chép tệp

file.copy

Sao chép tệp sang vị trí khác

Parameters:

NameTypeRequiredDefaultDescription
sourcestringYes-Path to the source file
destinationstringYes-Path where the file will be saved
overwritebooleanNoFalseReplace the file if it already exists

Output:

FieldTypeDescription
copiedbooleanĐã sao chép
sourcestringĐã sao chép
destinationstringĐã sao chép
sizenumberNguồn

Example: Backup file

yaml
source: data/important.csv
destination: backup/important.csv
overwrite: true

Example: Duplicate configuration

yaml
source: config.yaml
destination: config.backup.yaml

Xóa tệp

file.delete

Xóa tệp khỏi hệ thống tệp

Parameters:

NameTypeRequiredDefaultDescription
pathstringYes-Path to the file
ignore_missingbooleanNoFalseSkip without error if file does not exist

Output:

FieldTypeDescription
deletedbooleanĐã xóa
file_pathstringĐã xóa

Example: Delete temporary file

yaml
file_path: /tmp/temp.txt
ignore_missing: true

Example: Delete log file

yaml
file_path: logs/app.log

Di chuyển tệp

file.move

Di chuyển hoặc đổi tên tệp

Parameters:

NameTypeRequiredDefaultDescription
sourcestringYes-Path to the source file
destinationstringYes-Path where the file will be saved

Output:

FieldTypeDescription
movedbooleanĐã di chuyển
sourcestringĐã di chuyển
destinationstringĐã di chuyển

Example: Move file to archive

yaml
source: data/input.csv
destination: archive/input_2024.csv

Example: Rename file

yaml
source: report.txt
destination: report_final.txt

Released under the Apache 2.0 License.