How to save files in the project "Temp" folder using a relative path? (Download File activity)

Hi All,

I tried with ./Temp , .Temp, /Temp, ./Data/Temp, etc. :sweat:

I cannot use the absolute path of the project “C:\UiPath\ProjectName\Data\Temp…” because it will change later.

Thanks

2 Likes

it will be something like “data\temp”. Keep in mind if you use other apps to access files add the environment.currentdirecotry in front. You’ll need to add a "" if you use currentdirectory.

1 Like

Hi @Tana20,

“Data\Temp” will work.

Cheers
@Tana20

I meant to say add a \ infront of the data. So environment.currentdirectory+“\data\temp” will always work after you publish.

1 Like

Thanks guys but It doesn’t work either.

“Data \ Temp”
“\ Data \ Temp”
Environment.CurrentDirectory + “\data\temp”

I’m going to keep trying other combinations.

@Tana20 What error do you get ? Can you use Write Line to print the Path When you use Environment.CurrectDirectory+“\Data\Temp” , just to check the full path that you get and if you are able to access it manually

@supermanPunch no errors now, but for some reason, the activity “Download File” does not recognize the variable where the path was saved…

The variable “Temp” (String type) has the right path:
image

But the activity keeps opening my default “Downloads” folder:
image

@Tana20 Can you just double check the Path again using a Write Line Activity ? I am just making sure that there is no problem in the full path generated :sweat_smile:

The path exists, I can access it by copy/paste it in the file explorer

The Download File activity is a little misleading. It doesn’t actually download any file, it just monitors a folder and then returns the path to the newly downloaded file. In a newer version this activity has been renamed to “Wait for Download”.

The downloading is handled by your browser, so you need to set the “Downloads folder” to the folder where your browser usually saves downloaded files, e.g. “C:\Users\karende\Downloads”. You can then use a Move File activity to move the downloaded file (CLReport) to your Temp folder.

2 Likes

@ptrobot Thanks for the warning.
In the end, this was the solution:

3 Likes

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