1. Home
  2. Knowledge Base
  3. General Troubleshooting
  4. HEC-RAS File Name & Directory Path Issues

HEC-RAS File Name & Directory Path Issues

This article describes how to fix problems encountered with HEC-RAS file names and directory paths where the software will not run correctly.

When working on a HEC-RAS model in a network environment, where the project data resides in a project folder on a network server, the user might encounter issues where the analysis fails to run or there are other strange behaviours that are run into.

Because parts of HEC-RAS are written in the FORTRAN computer language, there exists length limits to the directory path and file names. The total length of the directory path and file name must be less than 260 characters. In addition, the directory path cannot be longer than 248 characters, because HEC-RAS writes out temporary files during its computations. This is similar to the file name and directory length limits in FORTRAN and Microsoft Windows. In Fortran 90/95 the maximum file name length is 31 characters, whereas in Microsoft Windows a directory path length can be a maximum of 247 characters long.

The file name and directory length limit can be difficult to handle when using HEC-RAS—especially in a network environment. HEC-RAS will report the following error message when the directory path and file name length is exceeded.

HEC-RAS File Name & Directory Path Issues

Solving the Long Directory Path and File Name Issue

These are some ways to solve the long directory path and file name issue when running HEC-RAS:

  1. Move the HEC-RAS project folder up several levels so that the directory path is not as long.
  2. In a network environment where the HEC-RAS project folder is on a network file server, move the folder to the local computer workstation.
  3. Map a drive letter to the HEC-RAS project folder.

Mapping a Drive Letter to a Local or Network HEC-RAS Project Folder

If the HEC-RAS project folder resides on the local workstation, then the SUBST command can be used to create a drive letter mapping to the project folder. If the HEC-RAS project folder resides on the local workstation or a network file server, then the NET USE command can be used.

Another difference between these two commands is that the SUBST command expects the location to always be available. If for some reason that location can’t be found, the SUBST command will try desperately to reconnect at the expense of your computers performance.

On the other hand, the NET USE command is more fault tolerant, which is why it can be used to connect to a network file server. When a mapped path appears to be disconnected, the NET USE command will gracefully disable that mapping until you try to access it again, at which point it will attempt to connect again.

Using the SUBST Command

To create mapping using the SUBST command:

  1. Open a Command Prompt There are numerous ways to open a Command Prompt window, but perhaps the easiest is to hold down the Windows key and then press the letter R on the keyboard.
  2. At the Command Prompt window, type-in the following:
    subst s: c:\HEC-RAS Project Directory Path

    where S: is the drive letter to assign to the HEC-RAS project directory path and

    c:\HEC-RAS Project Directory Path

    is the actual path on your computer workstation.

  3. Then, close the Command Prompt window.

To remove the mapping, at the Command Prompt window type-in the following:

subst s: /D

Note that when you reboot your computer, all mapped drive letters will be reset. To automatically map your folder when your system starts, put the SUBST command in a batch file, and put the batch file in your Autostart folder in the start menu. Advanced users can use the Windows Task Scheduler, however this is not covered here.

Note that you should execute the SUBST command using the account that issued it. These drive mappings are created only for the user who originally issued the SUBST command. For example, if you login as “Fred”, and you open a command prompt as “Administrator” and execute the SUBST command, then “Fred” will not be able to see any mapped drive letters because the mapping was created for “Administrator”. When using the Windows Task Scheduler to execute this command, make sure that the command is executed under the default user account.

Using the NET USE Command

To create mapping using the NET USE command:

  1. Open a Command Prompt
  2. For mapping a local folder to a drive letter, type-in the following at the Command Prompt window:net use s: c:\HEC-RAS Project Directory Pathwhere S: is the drive letter to assign to the HEC-RAS project directory path and
    c:\HEC-RAS Project Directory Path is the actual path on your computer.
  3. For mapping a network file server folder to a drive letter, type-in the following at the Command Prompt window:net use s: \\ServerName\HEC-RAS Project Directory Pathwhere \\ServerName\HEC-RAS Project Directory Path is the full UNC path to the shared folder on the network file server.
  4. Then, close the Command Prompt window.

To remove the mapping, at the Command Prompt window type-in the following:

net use s: /delete

You can use the asterisk as a wildcard character to delete all mapped drives in one command:

net use * /delete

By default, mapped drives using the NET USE command are not persistent, meaning that the mapped drive will disappear when you restart your computer. If you want the mapped drive stick around, you can make them persistent by using the /PERSISTENT switch. The switch works as a toggle:

  • /persistent:Yes
    Makes the mapped drive persistent. Future connections you make using the command during the same session are also persistent (you do not need to keep using the switch) until you use the /persistent:No switch to turn it off.
  • /persistent:No
    Turns off the persistency toggle. Future connections you make are not persistent until you turn the toggle back on.

So, to create a persistent mapped drive, type something like the following in the Command Prompt window:

net use s: c:\HEC-RAS Project Directory Path /persistent:Yes

Note that if there are issues regarding getting connected to a network drive or folder, it might be because the computer the user is trying to connect to is turned off, or the user does not have the correct access permissions.

Using File Explorer to Map a Drive Letter to a Network Folder

In addition to the methods shown above to map a drive letter to a network file server folder, File Explorer provides an easy-to-use way to do the same thing. See the below video.

Or, you can follow these steps to use File Explorer to map the HEC-RAS project folder to a unused drive letter:

  1. Open File Explorer. There are numerous ways to open File Explorer, but perhaps the easiest is to hold down the Windows key and then press the letter E on the keyboard.
    File Explorer
  2. Select This PC from the left pane. Then, select the Computer ribbon menu and click on the Map network drive menu command.
    This PC command
  3. The Map Network Drive dialog box will be displayed.
    Map Network Drive dialog box
  4. Click the dropdown combo box adjacent to the Drive entry, and select an available drive letter. (Any available drive letter will work.)
    What network folder would you like to map?
  5. Enter directory path in the text box adjacent to the Folder entry. Example: \\ServerName\FolderName. Alternatively, click the Browse button and interactively select the HEC-RAS project folder.
    Browse For Folder
  6. Turn on the Reconnect at sign-in check box to enable automatically connecting to the HEC-RAS project folder every time the user logs on to the computer.
    Reconnect at sign-in check box
  7. The Connect using different credentials check box can be used if there are multiple users that use the same computer workstation and need to access the same HEC-RAS project folder.
    Connect using different credentials check box
  8. Click the Finish button.

About the Author Chris Maeder

  • Was this helpful?
  • YesNo

Was this article helpful?

Related Articles