Search This Blog

Monday, May 16, 2011

PowerShell: List full path info for all files of specified extensions

I needed to get a list including path of all the files in a massive folder structure of a specified file extensions.

To do this I used PowerShell, using the Get-Childitem cmdlet to list folder content recursively and filtered to just list *.dll’s and *.exe’s. This is then piped to the foreach-object to iterate through and list the full file name (which includes path). This is then piped to the out-file cmdlet which dumps the contents into a text file.

Get-ChildItem \\remoteserver\remoteserverfolderpath  -Recurse -Include "*.dll","*.exe" | foreach-object {$_.Fullname} | Out-File c:\files.txt –width 1024


Share/Bookmark

1 comment: