Trailing slashes and "dir"

Traditionally used as path separators, the forward slash “/” is supported for use in the names of a directory as well as a file in ObjectStore (NS4).

This is important because it can affect how paths must be input with this action to obtain the desired response.

Trailing slashes in directory names

One or more trailing slashes can be used in a directory name, and not just as a path separator. (They can be used to end a directory name). Therefore, it is important to note the following to properly specify the desired directory as the [Path] variable for this call:

  • The Directory Name Contains No Additional Trailing “/”: If a directory in the path does not use any additional trailing “/” in its name, simply include a single “/” to serve as a path separator after the directory.
  • The Directory Name Contains Additional Trailing “/”: Include the appropriate number of trailing “/” to properly specify the directory by name, but also include one additional “/” to serve as the path separator. (For example, new// would be input as new///<next object>).
  • The Final Directory in the Path (IMPORTANT): ObjectStore (NS4) will automatically apply a final “/” in a path to denote that object as a directory. Therefore, the following apply:
    • If the Final Directory Name DOES NOT Contain Trailing Slashes: You can either leave the slash out of the path, in which case ObjectStore (NS4) will apply one as noted; or you can include a single “/”, and ObjectStore (NS4) will acknowledge it as a path separator.
    • If the Final Directory Name DOES Contain Trailing Slash(es): If the final directory name includes a single trailing slash in its name (“new/”), you must include an additional slash to denote it as a part of the directory name (“new//"). If the directory includes multiple trailing slashes, include only the specific number of trailing slashes in the title (“new//” would be specified as “new//” — no need to include an additional slash, because ObjectStore will recognize the object as a directory).

For example, if you have created a sub-directory named test/, in the root directory /new, this would result in the actual path being /new/test//. You would need to specify this full path — /new/test// as the “[Path]” variable to properly target this directory.

Trailing slashes in file names

Like a directory, a file can exist with one or more trailing slashes in its filename. For example, if you have created a symlink entitled link/, in the root directory /new, a dir action call with new defined as the [path] (“ GET /[CP Code]/new HTTP/1.1”) would reveal the following:

<stat directory="/[CP Code]/new"> 
    ... <file type="dir" name="link" bytes=”0” files="1" implicit=”true” >

Since the actual filename ends with a “/,” it is treated as an empty file name within the implicit directory, link. To properly view details on the symlink, its filename needs to be included in the call—GET /[CP Code]/new/link/ HTTP/1.1. (And, you would either include or omit the trailing “/”.) As a result, the response would look as follows:

<stat directory="/[CP Code]/new/link">
    <file type="symlink" name="" bytes=”0” mtime="1260000000" > 

Notice that the “name” attribute is empty, because rather than a directory revealing its contents, the actual file — link/ — was the target of the call.