Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Listing file name and file path (full path)

$
0
0

I have a list of files to be searched through a directory and sub directories. If the files if found within the folder structure i want it to be listed with full path.

How can i achieve with the powershell script please..

I tried something like this

Get-ChildItem -Recurse -Force $filePath -ErrorAction SilentlyContinue | Where-Object { ($_.PSIsContainer -eq $false) -and  ( $_.Name -like "*$fileName*") } | Select-Object Name,Directory | Out-File c:\temp\output.txt

i have two issue with above

it doesnt list the complete path.. it shows ... at the end

Not sure how I can loop through a list of files which I need to search through the directory if they exists.


Viewing all articles
Browse latest Browse all 6937

Trending Articles