How to quickly add a number of folders to Microstation's reference files search paths


Add a folder and its large number of subfolder to MicroStation's MS_RFDIR variable definition, which defines MicroStation's reference files search paths


The following steps will help adding a folder and all of its subfolders to MicroStation's reference files search paths.

Once the variable definition is ready, this can be added to either the standards.cfg file or to a PCF, if we want a different list selection of folders to be searched for each project. 

Steps to Accomplish

Option 1 Add the MS_RFDIR definitons directly to the standards.cfg file or to a .pcf file

1. Start an elevated DOS command prompt (type "cmd" in Window's search tab, then execute "cmd.exe" as an Administrator)

2. Navigate to the folder that needs to be added to the search path

3. Type "dir /s /b /o:n /ad > folders.txt" and hit Enter

You will now find a file called "folders.txt" in the main folder, this file contains a list of all the subfolders of the initial directory.

For Example, if we started the dir command in the "D:\Main folder" directory, which contained two subfolders, each with one additional subfolder, the text file will look like:

D:\Main folder\Subfolder1

D:\Main folder\Subfolder1\Subfolder11

D:\Main folder\Subfolder2

D:\Main folder\Subfolder2\Subfolder21

This file can be opened with an advanced text editor which allows you to find and replace text and "end of carriage" characters to make the above list turn into a proper MS_RFDIR definition:

MS_RFDIR = D:/Main folder/

MS_RFDIR > D:/Main folder/Subfolder1/

MS_RFDIR > D:/Main folder/Subfolder1/Subfolder11/

MS_RFDIR > D:/Main folder/Subfolder1/

MS_RFDIR > D:/Main folder/Subfolder2/Subfolder21/

Where I have simply replaced "D:" with "MS_RFDIR > ", "\" with "/" and "End of line character" with "/" (this requires an advanced text editor with support for regular expression and special character but can be done manually for small lists). The main folder path needs to be added manually.

You can copy and paste the "MS_RFDIR" entries into any PCF that requires them or into your standards.cfg if you want all of your projects to search these paths for reference files.

Option 2 Create a separate cfg files for reference search paths

In this case we will simply follow all the steps in Option1 above but then save the final MS_RFDIR definitions list as a separate configuration file, e.g. "reference_paths.cfg"

We can then specify to include these variable definitions into any other configuration files (e.g. PCF, UCF, etc) by adding the following string to it:

%include reference_paths.cfg

This can be useful when the exact same folders are using by several projects as updating one centralized .cfg file will update all PCFs using it.

See Also

Making Configuration Files Legible in Notepad++

Other language sources