commands

^

Resolve-DbaPath

Author Friedrich Weinmann (@FredWeinmann)
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out Resolve-DbaPath on GitHub.
Want to see the Bill Of Health for this command? Check out Resolve-DbaPath.

Synopsis

Resolves a path.

Description

Resolves a path.
Will try to resolve to paths including some basic path validation and resolution.
Will fail if the path cannot be resolved (so an existing path must be reached at).

Syntax

Resolve-DbaPath
    [-Path] <String[]>
    [[-Provider] <String>]
    [-SingleItem]
    [-NewChild]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Resolve-DbaPath -Path report.log -Provider FileSystem -NewChild -SingleItem

Ensures the resolved path is a FileSystem path.
This will resolve to the current folder and the file report.log.
Will not ensure the file exists or doesn't exist.
If the current path is in a different provider, it will throw an exception.

Example: 2
PS C:\> Resolve-DbaPath -Path ..\*

This will resolve all items in the parent folder, whatever the current path or drive might be.

Required Parameters

-Path

The path to validate.

Alias
Required True
Pipeline true (ByValue)
Default Value

Optional Parameters

-Provider

Ensure the path is of the expected provider.
Allows ensuring one does not operate in the wrong provider.
Common providers include the filesystem, the registry or the active directory.

Alias
Required False
Pipeline false
Default Value
-SingleItem

Ensure the path should resolve to a single path only.
This may - intentionally or not - trip up wildcard paths.

Alias
Required False
Pipeline false
Default Value False
-NewChild

Assumes one wishes to create a new child item.
The parent path will be resolved and must validate true.
The final leaf will be treated as a leaf item that does not exist yet.

Alias
Required False
Pipeline false
Default Value False