Skip to content

Instantly share code, notes, and snippets.

@karlarao
Last active November 4, 2023 14:54
Show Gist options
  • Save karlarao/c14413ba48e84f4de4dac84a297da1f6 to your computer and use it in GitHub Desktop.
Save karlarao/c14413ba48e84f4de4dac84a297da1f6 to your computer and use it in GitHub Desktop.
# on mac: brew install tree
# on linux: yum install tree
## the XML output is 5 directories deep and filtering any folder name with "tmp" in it
tree -d -L 5 -X -I tmp /Users/karl/Dropbox/CodeNinja/GitHub | sed 's/directory/node/g'| sed 's/name/TEXT/g' | sed 's/tree/map/g' | sed '$d' | sed '$d' | sed '$d'| sed "1d" | sed 's/report/\/map/g' | sed 's/<map>/<map version="1.0.1">/g' > /Users/karl/Dropbox/CodeNinja/GitHub/Gitmap.mm
## to filter multiple folders do the following
tree -L 7 -I "tmp|node_modules|bower_components"
@karlarao
Copy link
Author

karlarao commented Nov 14, 2016

Create a Mind Map File from a Directory Structure

sample output

@C-Bam
Copy link

C-Bam commented Aug 2, 2018

Pretty nice. I wish I could do the same in reverse. Like you design a folder structure in Freemind and then export it to XML or so and then create the whole tree on the system (with powershell,python,etc.)

@Rui-Xu
Copy link

Rui-Xu commented Aug 7, 2018

Hi karlarao,

Is there a rule for random node id number? I am trying to generate id myself for .mm file, but failed to open them in ithought app. I felt there is a rule for random id, isn't it?

@ericbaranowski
Copy link

@C-Bam for PS it'd be something like:

function recursivelyCreateFolders($childFolders, $newFolder) {
    foreach ($folder in $childFolders) {
        Write-Host $Folder.Name
        New-Item $Folder.Name -ItemType directory
        if($Folder.childnodes.count -gt 0)  {
            cd ".\$($Folder.Name)"
            recursivelyCreateFolders -childFolders $folder.ChildNodes -newFolder $newSubFolder
            cd ..
        }
    }
}

$myDirs=Get-Content C:\File\Path\myDirs.xml

recursivelyCreateFolders -childFolders $myDirs.baseDir.ChildNodes -newFolder $NewFolder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment