FileOperate icon

FileOperate

File system operations for files and directories

Delete Files

AI-generated

Overview

The node performs file system operations specifically for deleting files and directories based on user-defined criteria. It supports deleting files matching a regular expression pattern, recursively processing subdirectories, and selectively including files or subdirectories. It also offers an option to use shell commands for faster deletion on Linux/Unix systems, with the ability to specify file extensions for deletion. Additionally, it can delete the entire directory tree if desired and supports a stage test mode to simulate the deletion without actually performing it.

Use Case Examples

  1. Deleting all .txt files recursively in a directory.
  2. Deleting files and subdirectories matching a pattern without affecting other files.
  3. Using shell commands to quickly delete files with specific extensions on a Linux system.
  4. Simulating file deletion to verify which files would be deleted before actual removal.

Properties

Name Meaning
Directory Path The root directory path where files and directories will be deleted.
Pattern A regular expression pattern to match files or directories to be deleted.
Recursive Whether to recursively process subdirectories for deletion.
Include Types Select whether to include files, subdirectories, or both in the deletion operation.
Use Shell Command Use shell commands for faster file deletion on Linux/Unix systems.
Shell delete File Extensions Select file extensions to delete when using shell commands.
Shell Custom Extensions Custom file extensions (comma-separated) to delete when using shell commands.
Delete Root Directory Whether to delete the entire directory tree including the root directory.
Stage Test Simulate the deletion operation without actually performing it.

Output

JSON

  • result - Result of the delete files operation, including details of deleted files and directories.

Dependencies

  • File system access is required to perform deletion operations.

Troubleshooting

  • Common issues include permission errors when attempting to delete files or directories. Ensure the node has appropriate file system permissions.
  • If using shell commands on non-Linux/Unix systems, deletion may fail or behave unexpectedly.
  • Incorrect regular expression patterns may result in no files being deleted or unintended files being deleted. Verify the pattern syntax.
  • If 'Stage Test' is enabled, no files will be deleted; disable it to perform actual deletion.

Discussion