|Author||Friedrich Weinmann (@FredWeinmann)|
|Availability||Windows, Linux, macOS|
Resolves a path.
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).
Resolve-DbaPath [-Path] <String> [[-Provider] <String>] [-SingleItem] [-NewChild] [<CommonParameters>]
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.
PS C:\> Resolve-DbaPath -Path ..\*
This will resolve all items in the parent folder, whatever the current path or drive might be.
The path to validate.
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.
Ensure the path should resolve to a single path only.
This may - intentionally or not - trip up wildcard paths.
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.