Referencing Project Folders in Config File

Using the config file, I want to reference a folder inside the project folder when running a process from orchestrator. What is the correct syntax to reference that folder?

For example:

Main project folder is called HR
There is a sub folder inside that folder named Library and I want to access the files inside that folder. How do I indicate this in the config file so that it isn’t hardcoded to the G drive and will just use the current working project folder? Thanks

1 Like

Hi,

You can use Orchestrator-provided asset. Asset type should be string.

Mark it as solution if it solves your issue.

Thanks

I want to accomplish this without using an Asset

Then you can do one thing. First part of the path should come from config file.

Then get folders from folders which starts with specific keywords.

I am asking what the syntax of the path should be in the Config file

\Library ?

Library ?

\Library\ ?

Hi @jpreziuso

folder within the project will be search with out the full path need, just provide the name of the folder as

Library

if there is a folder within the library just add the path like

Library\otherFolder

Regards

You don’t reference the project folder at all. That’s just for where your files are stored and has nothing to do with the working folder when the job runs for real.

As is standard for anything Windows, simply reference the folder name without anything before it, and the current local folder is assumed as the context. It’s no different than being at a command line, if you’re in “C:\somefolder” and want to CD to “C:\somefolder\subfolder” you just type “CD subfolder”

So in your automation if you want to reference a folder named “Library” inside your project folder, you just put “Library” - say there’s a text file in Library that you want to read with Read Text File. You just give Read Text File “Library\textfilename.txt”

Thank you, this is helpful

Thank you, this was very helpful

So I have the path in the Config file just listed as Library since that is the subfolder. This works when I run from Studio but when I run the packaged version from orchestrator, it can’t find the file inside that subfolder via the path in Config.

Any idea why?

Are there actually files in the folder or does the automation create the files? Empty folders don’t publish along with the project.

If you have some sort of non-code file that your process is using then you shouldn’t store it in the project folders. Any time that file changes you’d have to re-publish your code. Those kind of files should be stored in a shared/network folder and you should use the full path (not mapped path).

There are files in the folder but they are .bat files and .jar files. They never get changed. I tried to put this entire folder into a shared network folder but the process was not able to access the folder for some reason. I can try doing that again though

The robot account would need to be granted access to the folder if it’s a network share. Remember, unattended automations run logged in as the robot account.

If the files don’t change then it’s not a problem to store them in the project folder.

What does “can’t find” mean? Are you getting an error? Which activity? Show the activity and how it’s configured. Are you using…

Config(“somepath”).ToString + “somefilename.jar”

That’s unreliable. You should always use Path.Combine:

Path.Combine(Config(“somepath”).ToString,“somefilename.jar”)

That way it ensures that you end up with a proper path ie…

C:\Somefolder\somefilename.jar

and not

C:\Somefoldersomefilename.jar

The robot does have access to the shared folder. I just tried using the shared path again but it failed to correctly run the .bat file which creates a flat PDF and then a CSV.

When I tried to run the process with the folder inside the project folder, “can’t find” means that it was unable to find the .bat file with the path I provided.

image

When I attempted to give the whole path, I did not use Path.Combine like you suggested, I can try that next.

I am also concerned because the package in orchestrator does not show the Library folder

image

However, I’d rather get it to work with the Library folder in a shared network path, but like I said it runs the .bat file in that scenario but it fails to create the correct output

You didn’t provide a path there, only the filename. You have to provide the path to FlatAndTable.bat

The first box is the path and filename to the batch file, the second box is arguments to pass to the batch file.

What are you trying to do in this batch file?

I thought it used the working directory parameter to know where the file is. But I have also tried the full path and that did not seem to work

The batch file takes a PDF and flattens it and then turns it into a readable CSV. I thought I had the problem fixed because I changed the paths inside the batch file to use full paths instead of just file names but it still did not work

The batch file is failing because “UNC path is not supported” in the cmd window. I am not sure what to do about that

image

I just attempted to use this as the file path so it ends up being Library\FlatAndTable.bat as the file path but it failed. The error is “The system cannot find the specified file”

I do not know what to do anymore