Skip to content

File Operations

Copy, move, and delete files.

3 modules

ModuleDescription
คัดลอกไฟล์คัดลอกไฟล์ไปยังตำแหน่งอื่น
ลบไฟล์ลบไฟล์จากระบบไฟล์
ย้ายไฟล์ย้ายหรือเปลี่ยนชื่อไฟล์

Modules

คัดลอกไฟล์

file.copy

คัดลอกไฟล์ไปยังตำแหน่งอื่น

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ไฟล์ที่คัดลอก
sourcestringไฟล์ที่คัดลอก
destinationstringไฟล์ที่คัดลอก
sizenumberไฟล์ต้นทาง

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

ลบไฟล์

file.delete

ลบไฟล์จากระบบไฟล์

Parameters:

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

Output:

FieldTypeDescription
deletedbooleanไฟล์ที่ลบ
file_pathstringไฟล์ที่ลบ

Example: Delete temporary file

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

Example: Delete log file

yaml
file_path: logs/app.log

ย้ายไฟล์

file.move

ย้ายหรือเปลี่ยนชื่อไฟล์

Parameters:

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

Output:

FieldTypeDescription
movedbooleanไฟล์ที่ย้าย
sourcestringไฟล์ที่ย้าย
destinationstringไฟล์ที่ย้าย

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.