How to use project's folder without using hard code?

Hello !

I would like to use the folder I created in my project.
So I created 5 folders. Which are automatically created in the Windows system as well.

The problem is that I want to ‘call’ them easily in the project without hardcoding. Is there a way to call them using attributes of the project ?

I imagine an expression that would be something like project.NameFolders.list

I know I can use the activity get folder info. But I have to hard code the path of the current project I’m working on. I cannot use any attributes of the project like project.folder.path. At the moment I have to assign a the path of the project using hard code.

Do you have to way to use the properties of the “current” project in order to get the list of the folders ?

@LamaX

Environment.CurrentDirectory will give you the current directory/Project path

Also generally relative paths are supported for folders inside your project

cheers

1 Like

Hi

You can mention the relative path which means you don’t need to put the complete filepath

Just mention the folder name alone and following folder name or file name directly in your workflow

It will work
Have a view on this thread to know about absolute filepath and relative filepath

If you want to call workflow from the folders you created then u can use INVOKE WORKFLOW ACTIVITY and click on the folder button to call them

Cheers @LamaX

1 Like

we can do:
Path.Combine(Environment.CurrentFolder, "SubFolderNameOrPath")

1 Like

For additional checks also have a look here:
[CheatSheet] - Filesystem APIs - News / Tutorials - UiPath Community Forum

All Folders
Directory.GetDirectories(Environment.CurrentFolder)

All Folders including Subfolders
Directory.GetDirectories(Environment.CurrentFolder,"*",SearchOption.AllDirectories)
1 Like

This is a very cool expression.

I just mentionned the folder name like “Initialisation” in the ‘path field’ and he recognized it as a folder and used it as a full path.

It’s amazing. Thank you also @Palaniyappan and @ppr !

2 Likes

If it’s clarified

@LamaX

1 Like

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