Rename file- Could not find a part of the path

Getting an error on - Could not find a part of the path in Rename file activity
i have checked file and new name output on write line and it shows correct output but in rename file i am getting an error.

Same inputs working on another workflow.

Hi @Luffy

I got this issue recently too. Coldn’t find a solution for it with “rename file” so I used move file(you can rename file while moving it to other folder too) which solved my problem.

Find the below thread -

Hope it helps!!

@Luffy

  1. Check the file path: Double-check the file path you are using in the Rename File activity. Ensure that it is a valid and complete path to the file you want to rename. Make sure there are no typos, missing slashes, or incorrect folder names.
  2. Verify file existence: Before attempting to rename the file, make sure the file exists at the specified location. You can use the File.Exists() method to check if the file is present before attempting to rename it.
  3. Check for file locks: If the file is being used by another process or application, it might be locked, and you won’t be able to rename it until it’s released. Ensure that the file is not open in any other application or process.
  4. Permissions: Ensure that you have the necessary permissions to access and modify the file in the specified location. If you are running the robot in a restricted environment, it might not have the required permissions to rename the file.
  5. Dynamic file paths: If you are constructing the file path dynamically using variables, check the values of those variables to ensure they are correct at runtime.
  6. Error handling: Implement error handling in your workflow to capture and handle any exceptions that might occur during the renaming process. This way, you can get more specific information about the error and take appropriate actions.

Hope it Helps!!

I have created another sample flow with same inputs which is able to rename the file but i am getting an error in my main flow.

I have already double checked the input and output value of rename file in write line which is correct.

@Luffy

Can you send the screenshot of your re-name activity

Regards


use this for reference

@Luffy can you place log message before Rename activity and place this whole expression in it so that you can see it is proper path or not

@Luffy

try giving currentitem.fullname in file path and in new name give name to be replaced so that the file name will be replaced with the given name.

Hope it works!!

already did ,as suggested by mahesh by replacing rename file activity with move file i am able to get the correct output.

Don’t know why rename file are getting an error.

What is the filename you’re trying to rename to? Slashes in the filename will cause this error.

Also, make sure in the New Name make sure you’re only passing the filename, not the full path.

The issue is probably in that split you’re doing. What is the original value and why are you splitting? Show the whole expression.

original value is like
ABCD-12637388_07-19-2023-13-40.xlsx

Output we want -
ABCD-12637388_07.xlsx

Is that what your two expressions are returning?

Put them in Log Message activities before the Rename File activity, to see what values you’re actually giving it.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.