Summary of the new feature/enhancement
As a PowerShell developer, I want to be able to obtain the path of an item relative to a path that is not my current directory so that I can avoid changing my current location context for a relative directory lookup.
Proposed technical implementation details
Assuming I have a directory like this:
/MyProject
|-/dir
|-test_1.txt
|-test_2.txt
|-/subdir
|-test_3.txt
Currently, if I want to do a resolve a path relative to a different directory, I have to use set-location before calling Resolve-Path. For example, if I wanted to get all my .txt file locations relative to dir, I would have to do something like this:
/MyProject> cd dir
/MyProject/dir> Get-ChildItem -Recurse -Include "*.txt" | Resolve-Path -Relative
./subdir/test_3.txt
./test_1.txt
./test_2.txt
/MyProject/dir> cd ..
Ideally, I would like to do something like this:
/MyProject> Get-ChildItem .\dir -Recurse -Include "*.txt" | Resolve-Path -Relative -ReferencePath .\dir
./subdir/test_3.txt
./test_1.txt
./test_2.txt
Summary of the new feature/enhancement
As a PowerShell developer, I want to be able to obtain the path of an item relative to a path that is not my current directory so that I can avoid changing my current location context for a relative directory lookup.
Proposed technical implementation details
Assuming I have a directory like this:
Currently, if I want to do a resolve a path relative to a different directory, I have to use set-location before calling
Resolve-Path. For example, if I wanted to get all my.txtfile locations relative todir, I would have to do something like this:Ideally, I would like to do something like this: