Created
October 24, 2025 09:21
-
-
Save obar1/9bb3ea06a4e5f9181e872915f697fec4 to your computer and use it in GitHub Desktop.
list dirs and save in md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Define output file | |
| $outputFile = "Subfolders.md" | |
| # Get current directory | |
| $currentDir = Get-Location | |
| # Get all subfolders | |
| $subfolders = Get-ChildItem -Path $currentDir -Directory | |
| # Start Markdown content | |
| $markdownContent = "# Subfolders in `$($currentDir)`n`n" | |
| # Add each subfolder as a bullet point with space replaced by %20 | |
| foreach ($folder in $subfolders) { | |
| $encodedName = $folder.Name -replace ' ', '%20' | |
| $markdownContent += "* [here](./$encodedName/readme.md)`n" | |
| } | |
| # Save to file | |
| $markdownContent | Out-File -FilePath $outputFile -Encoding UTF8 | |
| Write-Host "Markdown file saved as $outputFile" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bash version