Import workflow to another PC without having problems in file destinations

Hi guys, so every now and then I transfer my workflow from my PC to another PC, but every time I do that, I need to update the file destination, e.g. (C:/users/MyPC/UiPath/SampleWorkflow to C:/users/opc/UiPath/SampleWorkflow) can I do something to make my workflow work in my other PC without having to change all the paths altogether?

@UiP_Mc I feel you have answered the question Yourself :sweat_smile:, If only MYpc and opc are the names which change you can use a variable to assign and append it in that place where it is changing

Not entirely, that’s just a sample, the file names differ a lot, I’ve thought of variables but my workflows don’t only point to one destination, there’s a lot of them, and if possible, I wanted to get rid of all the updating part in my new PC.

If the workflow is in the project’s folder, the path is simply: nameOfWorkflow

To get the Full Path in a dynamic way, you can use:
Directory.GetCurrentDirectory + \ + nameOfWorkflow

\ should be between quotes.

1 Like

Have you looked at the “Get Environment Folder” task?
If you’re trying to access a user specific folder like Desktop, My Documents or Downloads for the current user, this could be useful in generalizing your file location.
folders

If you are looking for workflows to invoke that you use often, you can also consider turning your common workflows into a library and adding them as a dependency. You can add them to a nuget feed and add them like you would any other UiPath package.

1 Like

Should it be like this?
Assign nameOfWorkflow = Directory.GetCurrentDirectory +""+ nameOfWorkflow?

try to use Environment.CurrentDirectory which it will recognize the current directory without the need to change hardcoded path.

For example; if you want to save file in SampleWorkflow\Data, use Environment.CurrentDirectory+“\Data” as it will recognize the current directory path without having the need to use " C:\users\ MyPC \UiPath\SampleWorkflow\Data".

2 Likes