Skip to main content

1E 8.1 (on-premises)

FileSystem.FindDirectoryByName

Method

FindDirectoryByName

Module

FileSystem

Library

Core

Action

Finds directory paths given a leaf directory name.

Parameters

DirectoryName (string): The name of the directory to be found. This cannot contain path separators and therefore is always just the leaf node of the path (the deepest part of the path).

Note

The name can include wildcard characters ? and *.

Case insensitive wildcards are supported only on Windows.

Fast (boolean; optional, default true): Selects either the fast NTFS search technology or the previous,slower (but fully reliable) technology.

Note

Unix Fast=false and NTFS fast=true are similar order timescales (unless the Unix method comes across a mounted windows share); NTFS Fast=false is significantly slower.

TimeoutSecs (integer; optional, default 600): If the operation has not completed within the specified time period, it will fail with an error.

Exclude (Table, optional): A single column table where each row contains a root relative directory path that you want to exclude from recursive search.

Note

On Windows, excluded paths can contain drive letters on Windows (e.g. C:\\), to skip scanning whole volumes.

Ensure the exclude paths are complete paths starting from root.

Return values

For each directory found:

  • Path (string): The full path of the directory.

Example

FileSystem.FindDirectoryByName(DirectoryName:"wibble", Fast:true);

The above method call might find the following on relevant platforms:

C:\Program Files\Acme Corp\Wibble

/usr/local/wibble

But it will never find these:

C:\Program Files\Acme Corp\Wibble\bin

/usr/local/wibble/bin

@exclude =
SELECT
        column1 AS Path
FROM
        ( VALUES
                ("C:\\"),
                ("E:\\IgnoredFolder")
        );

FileSystem.FindDirectoryByName(DirectoryName:"wibble",Exclude:@exclude);

Platforms

  • Windows

  • Linux

  • MacOS

Notes

This method searches all fixed disks, which is a resource expensive process and may take some time if Fast=false.

Symbolic links are ignored on non-Windows OS.