Skip to content

Instantly share code, notes, and snippets.

@mark05e
Created October 20, 2024 12:37
Show Gist options
  • Save mark05e/dd6afefd59e9ea1d9a28a4972329458c to your computer and use it in GitHub Desktop.
Save mark05e/dd6afefd59e9ea1d9a28a4972329458c to your computer and use it in GitHub Desktop.
# Get all files in the current directory, excluding the output file
Get-ChildItem -File | Where-Object {$_.Name -ne "file_contents.txt"} | ForEach-Object {
# Print the filename
"Filename: $($_.Name)"
# Print the file contents
"Contents:"
Get-Content -Path $_.FullName
"------------------------"
} | Out-File -FilePath "file_contents.txt" -Encoding utf8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment