Skip to main content

Merge all notes

You must manually set $VaultPath before you run the script.

$AllFiles = Get-ChildItem -Path $VaultPath -File -Recurse | ForEach-Object { $_.FullName }

$MDFiles = $AllFiles | Where-Object {$_ -like "*.md"}

$MainPath = "$VaultPath\thebigone.txt"

New-Item -Path $MainPath -ItemType File

foreach ($file in $MDFiles) {
	Write-Host $file
	$title = ($file -split "\\")[-1]
	"`n# $title`n" | Add-Content -Path $MainPath
	Get-Content -Path $file | Add-Content -Path $MainPath
}