powershell script to combine the content of multiple txt file with filepath as separator
Tue Dec 05 2023 22:13:30 GMT+0000 (Coordinated Universal Time)
Saved by
@baamn
$files = (dir *.txt)
$outfile = "out.txt"
$files | %{
$_.FullName | Add-Content $outfile
Get-Content $_.FullName | Add-Content $outfile
}
if you only want the filename, but not the path, switch the line which is $_.FullName | Add-Content $outfile to read $_.Name | Add-Content $outfile
content_copyCOPY
https://superuser.com/questions/682001/combine-multiple-text-files-filenames-into-a-single-text-file
Comments