Using a PowerShell cmdlet (non-alias), pipe the contents of your current directory into a Where-Object search to find a file or group of files by partial or full filename. (Suggestion: Use part or all of a filename to filter everything else out of a directory listing. It’s much easier to test by looking for a file that really exists)
POWERSHELL PLEASE!
get-ChildItem $targetDir -recurse | where {$_.name -like $pattern} | select name
The Get-ChildItem cmdlet gets the items in one or more specified locations. If the item is a container, it gets the items inside the container, known as child items. You can use the Recurse parameter to get items in all child containers and use the Depth parameter to limit the number of levels to recurse.
where clause is used to define the regular expression of the required type.
select is used to select a specific field
Get Answers For Free
Most questions answered within 1 hours.