Uipath cannot find part of the file exception

Hi all,

I am getting the exception while running the code - Cannot find the part of the path actually i am trying to delete the files in the temp folder…the code is running fine in Dev machine but when same code is executed in production machine i am getting this error.

In for each loop i am using the below code
Directory.getfiles(Environment.currentuser+”\Data\Temp”

And inside i am using delete file activity to delete the files but it is giving the above error.

Can anyone please help me out for this solution

Hi @vishal_nachankar ,

Try this:

Directory.getfiles(Environment.currentdirectory+”\Data\Temp”)

Its Environment.currentdirectory not Environment.currentuser.

Hope it helps.

sorry i am using the same only but still it is failing

What is the error?

Give this a try:

Directory.getfiles("Data\Temp”)

The path is of project folder…but i guess we need to provide Environment .Currentdirectory+path the error is
Cannot find the part of the path this exception i am getting.

That may be because Temp folder was empty when you published the package. Empty folders doesn’t get published. So in RE framework placeholder.txt file comes by default.

Check if Temp folder is empty.

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