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
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”
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.
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:
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.
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
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
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
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”