Rename File/Folder

🧾 Definition

The “Rename File/Folder” action in the OneDrive category allows you to update the name of an existing file or folder in your OneDrive storage. Whether you need to correct a naming error, apply a standardized naming format, or rename based on workflow conditions, this action offers flexibility and precision.

🔑 Key Capabilities:

  • Rename both files and folders within your OneDrive.
  • Choose items via a visual OneDrive picker or dynamically using file/folder ID or path.
  • Maintain file extensions when renaming files (e.g., .pdf, .xlsx, etc.).
  • Seamlessly integrates with automated workflows where naming conventions or changes are triggered by form data, dates, or approval stages.

This action ensures your OneDrive stays organized, easy to search, and follows structured naming standards — all through automation.



💡 Example Use Cases

1. Rename Files After Approval

When a document is reviewed and approved, automatically rename it to reflect its new status (e.g., Contract_Draft.pdfContract_Approved.pdf) for better version tracking.

2. Standardize Naming from Form Submissions

Files uploaded through a form or process can be renamed based on user input (e.g., renaming upload.pdf to Invoice_#12345.pdf), making them easier to search and organize.

3. Rename Folders for Workflow Stages

In multi-stage workflows (e.g., HR onboarding, project pipelines), folders can be renamed based on progress—like changing Candidate_X_Stage1 to Candidate_X_Stage2.

4. Add Date or Timestamp to Reports

When storing regular reports, add dynamic timestamps to the file name (e.g., SalesReport.xlsxSalesReport_2025-08-06.xlsx) for clear historical tracking.

5. Bulk Rename for Migration or Cleanup

During data cleanup or migration, use automated renaming to fix inconsistencies (e.g., lowercase all filenames or add prefixes like ARCHIVE_ to older items).



🛠 Inputs

This action requires you to provide the necessary details about the file or folder you want to rename in OneDrive. Each input field helps define what item you’re targeting and what the new name should be.


1. Connection

This field represents the authenticated OneDrive connection. You must be signed in with a valid OneDrive (Personal or Business) account to interact with files or folders.


2. Selecting File or Folder

Choose the specific file or folder you want to rename. You can select it in two ways:

  • Option 1: OneDrive Picker UIClick the field to open a pop-up where you can visually browse and select the file or folder from your OneDrive account.

  • Option 2: Manual Input via ID or PathYou can provide the location of the item using:

    • ID: A unique OneDrive file/folder identifier like:1EED600A8F0FD9A1!s75181466e59d4bacb1ec55930b932ed1
    • Path: A relative path to the file/folder, e.g.:/drive/root:/Pictures/Screenshot 2023-05-10 125216.png
📌

To enable path-based input, activate the “Select by path” toggle.If disabled, you must provide the ID.


3. ✏️ Item Name

Enter the new name that the selected file or folder should be renamed to.

  • For files, you must include the correct file extension (e.g., .pdf, .docx, .png).Example: Final_Report_2025.pdf
  • For folders, just the folder name is sufficient.Example: Archived_Projects
⚠️

Important: The name must not conflict with other items in the same directory and must comply with OneDrive naming conventions (e.g., no special characters like *, :, ?).



📤 Outputs

After the rename action is executed, the following details are returned, providing useful metadata and access links for the renamed file or folder:


1. 🆔 Id

A unique identifier for the renamed file or folder within OneDrive. This ID can be used in future actions (such as download, share, or move) to reference this specific item.

🔁

Helpful for linking this item to other steps in your flow.


2. 📝 Name

The new name of the file or folder after the rename operation is completed.

📌

Confirms that the rename was successful and reflects the updated name you provided in the input.


3. 📍 Path

The full OneDrive path to the renamed file or folder. This path shows the item's new location in the directory structure, including any parent folders.

📂

Example: /drive/root:/Projects/Final_Report_2025.pdf


4. 📁 Type

Indicates whether the item is a file or a folder.Possible values: file or folder

📊

Useful when building conditional logic in your flow to treat files and folders differently.


5. 🌐 Web URL

A web link that opens the renamed file or folder in the OneDrive web interface. This link can be shared with others (depending on permissions) or used to verify the result.

🔗

Perfect for adding to emails or Slack messages for quick access.


6. 📥 Download URL (Files only)

A direct download link to the file. This is a pre-authenticated, secure URL that allows downloading the file without signing in again.

Only available if the renamed item is a file, not a folder.


7. 📄 MIME Type (Files only)

Specifies the file format using a standard MIME type (e.g., application/pdf, image/png, text/plain). Helps identify the type of content programmatically.

📘

Useful for sorting or filtering different file types in automated flows.


8. 📦 Size (Files only)

Indicates the total file size in bytes.Example: 1048576 bytes = 1 MB

📐

Great for validating large file operations or applying file size limits.



Example: Automatically Renaming Uploaded Reports

Scenario:

Let's say you're building a workflow where users upload weekly sales reports to a shared OneDrive folder. These reports often have inconsistent filenames (e.g., “Report.pdf”, “report_final_1.pdf”), making it hard to organize and search later. You want every file to follow a consistent naming convention like:👉 Sales_Report_Week_32_2025.pdf


✅ Goal:

Automatically rename every uploaded file to a standard format once it's added to OneDrive.


🔧 Setup in Your Flow:

  1. **Trigger:**Use a "When a file is created in a folder" trigger for the shared reports folder.

  2. Add the "Rename File/Folder" action:

    • Connection: Connect to your OneDrive account.

    • Selecting File or Folder: Use dynamic tokens from the trigger to reference the newly uploaded file.✅ Enable “Select By Path” and map the file path using: /drive/root:/Reports/@{triggerOutputs()?['body/name']}

    • Item Name: Use an expression or dynamic content to define the new name.For example: Sales_Report_Week_@{utcNow('dd')}_@{utcNow('yyyy')}.pdf


▶️ What Happens:

Once a file is uploaded to the Reports folder:

  • The flow runs and picks the new file.
  • It renames it to the format Sales_Report_Week_32_2025.pdf based on current date.
  • The output includes the updated file ID, name, path, and a direct download or web URL.

🎯 Result:

Your OneDrive folder stays organized with consistent file names, making it easier for teams to find and use the reports without confusion.