Try Something like this Get-childItem -path D:\Root\b* -Include *.html > C:\A_Temp_Folder\test.txt -Recurse -Force