'Move File' throwing 'Could Not Find File' error when file exists

I am updating an old process in which a file is uploaded to a site from a shared drive folder and then moved to an archive folder. The whole process is run on a loop based on the files in the shared folder (Directory.GetFiles(“FolderPath”)).

Immediately before moving the file, it is uploaded to the site via a generic Chrome file explorer window with the path being typed out using item.ToString. Three activities later, the same item.ToString is used in the ‘Move File’ activity and I get the ‘Could Not Find File’ error even though the exact same string was just used to interact with the file and I can see the file in front of me.

Copy and and pasting the file path from the error message opens the correct file so I know it is pointing to the correct location. I have also dropped in a ‘Path Exists’ which returns a ‘False’ on the same item.ToString. The destination folder also exists and already has a handful of files in it.

Any help is appreciated, happy to grab some screenshots or give more details.

-D

@Drake_P

May i jnow is it happening on any specific file or all files?

And did you change the type argument in for loop to string…this is just a caution and you need not use .ToString again

Do you see any extra slashes that are coming?

Can you tey with path.Combine(item)

Cheers

This is happening with all files.

The argument is currently left on ‘Object’ - should that be changed? At this point I would have to make a number of adjustments to remove .ToString from other points if I do that.

There are no extra characters at all.

Unless I misunderstood, strFullPath=path.Combine(item) returned the same error as using item.ToString and also gave a ‘False’ on the ‘Path Exists’ activity.

It looks like there is some correlation between the uploading of the file and not being able to interact with it as I can move the file using either string prior to the upload process. After selecting it in the file explorer I cannot move or delete it (‘Could Not Find File’ error)

Adding a looping delay until the file “exists” again solved the issue… not sure what would cause UiPath to fail to see the file in the folder after the upload but it appears it takes an average of four seconds before it continues.

Thanks for the help @Anil_G

-D

1 Like

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