Reputation: 1317
I want to search for a file in the parent directory. So far I have
Get-ChildItem -Filter *.xap
What I want is to search for this file in the parent directory (the file is located in another folder in the parent folder). Any advice on how to do this with PowerShell?
Upvotes: 0
Views: 1192
Reputation: 174465
Specify the Path
parameter with a value of ..
, so use the parent directory as the base of your search:
Get-ChildItem -Path .. -Filter *.xap
If the file(s) you're looking for are not located directly inside the parent directory, but another subdirectory of the parent, either use the -Recurse
switch parameter to perform a recursive search, or use ..
in a relative path:
Get-ChildItem -Path ..\otherfolder
or
Get-ChildItem -Path .. -Recurse
Upvotes: 1