Rename File
Renames files in cloud storage.
Overview
The Rename File node changes file names in place without moving them. Use it to:
- Standardize file naming conventions
- Add prefixes or timestamps
- Clean up file names
- Update names after processing
Parameters
| Parameter | Description | Required |
|---|---|---|
| File | File to rename | Yes |
| New Name | The new filename | Yes |
File
The file to rename. Typically from a trigger or upstream node:
{{$item}}
{{$item.data.file}}
New Name
The new name for the file. The original extension is preserved automatically if not included in the new name:
{{$item.data.customerName}}_invoice
{{$item.data.date}}_{{$item.data.reportType}}_report
processed_{{$item.file.name}}
Output
The item passes through with updated file information reflecting the new name.
Examples
Add Date Prefix
Prefix files with processing date:
- File:
{{\$item}} - New Name:
{{new Date().toISOString().split('T')[0]}}_{{\$item.file.name}}
Produces: 2024-01-15_original_name.pdf
Standardize Names
Create consistent naming:
- File:
{{\$item}} - New Name:
{{\$item.data.customerId}}_{{\$item.data.documentType}}
Clean File Names
Remove spaces and special characters:
// In JS Code node before Rename File
return {
...item,
cleanName: item.name.replace(/[^a-zA-Z0-9.-]/g, '_')
};
Then in Rename File:
- New Name:
{{\$item.data.cleanName}}
Add Processing Indicator
Mark files as processed:
- File:
{{\$item}} - New Name:
[PROCESSED]_{{\$item.file.name}}
Sequential Naming
With a counter from upstream processing:
- File:
{{\$item}} - New Name:
document_{{\$item.data.index.toString().padStart(3, '0')}}
Produces: document_001.pdf, document_002.pdf, etc.
Tips
- File extension is preserved automatically
- If you include an extension, it overrides the original
- Use expressions for dynamic naming
- Test with a single file before batch operations
- Handle naming conflicts—duplicate names may cause errors
- Combine with Copy File for copy-and-rename operations