Dynamic File List Processor & Logger
detail.loadingPreview
Automate the processing of file lists with this efficient n8n workflow. It reads items from a specified text file, iterates through each line, and executes a custom shell command for every entry, logging the results to an output file.
About This Workflow
This robust n8n workflow provides a powerful solution for dynamically processing lists stored in a text file. Upon execution, it reads /home/n8n/filelist.txt line by line. Utilizing a custom Function node, it parses the file content into an iterable array. A clever looping mechanism, implemented with an IF node and the $runIndex variable, ensures that a specified shell command is executed sequentially for each item in the list. The workflow then logs a custom message, incorporating the current list item, to /home/n8n/n8n-output.txt. Perfect for batch operations, system administration, and automated reporting tasks, this workflow demonstrates flexible command-line integration and dynamic data handling.
Key Features
- Dynamic List Processing: Automatically reads and processes each line from a designated text file as individual data points.
- Custom Command Execution: Execute any shell command for each item in your list, enabling highly flexible automation.
- Workflow Looping: Implements a custom looping mechanism to ensure all items in a list are processed sequentially.
- Automated Logging: Appends detailed output, including processed item names, to a specified log file.
- Extensible Logic: Easily modify the
FunctionandExecute Commandnodes to tailor the processing and output to your specific needs.
How To Use
- Start the Workflow: Simply click "Execute Workflow" to initiate the process.
- Configure Input File: In the
Read Binary Filenode, update thefilePathparameter to point to your desired text file containing the list of items (e.g.,/path/to/your/list.txt). Each item should be on a new line. - Customize Data Parsing (Optional): The
Functionnode currently splits the file content by newlines. If your list requires different parsing logic (e.g., comma-separated values), modify thefunctionCodeaccordingly. - Define Your Command: In the
Execute Commandnode, modify thecommandparameter. Replace the exampleecho "The file name is ..."with the shell command you wish to execute for each item. Use{{$node["Function"].json["arrData"][$runIndex]}}to dynamically reference the current item from your list. - Set Output Log: Adjust the output
filePathin theExecute Commandnode (e.g.,/home/n8n/n8n-output.txt) to your preferred log file. - Understand the Loop: The
IFnode, in conjunction with the$runIndexvariable, facilitates iterating through each item from theFunctionnode's output. This loop ensures theExecute Commandnode is re-triggered until all items are processed.
Apps Used
Workflow JSON
{
"id": "889e8004-28c6-417d-8ed1-86c43ff81ad8",
"name": "Dynamic File List Processor & Logger",
"nodes": 29,
"category": "DevOps",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 889e8004-28c6...
About the Author
DevOps_Master_X
Infrastructure Expert
Specializing in CI/CD pipelines, Docker, and Kubernetes automations.
Statistics
Related Workflows
Discover more workflows you might like
Automate Qualys Report Generation and Retrieval
Streamline your Qualys security reporting by automating the generation and retrieval of reports. This workflow ensures timely access to crucial security data without manual intervention.
Automated PR Merged QA Notifications
Streamline your QA process with this automated workflow that notifies your team upon successful Pull Request merges. Leverage AI and vector stores to enrich notifications and ensure seamless integration into your development pipeline.
Robust Concurrency Control for n8n Workflows with Redis
Prevent simultaneous execution of critical n8n workflows or tasks using a centralized, Redis-backed locking mechanism. This reusable utility workflow ensures data integrity and resource management by allowing other workflows to acquire, check, and release locks.