Skip to content

Commit

Permalink
Update ConvertOneNote2MarkDown-v2.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
nixsee committed Oct 2, 2020
1 parent db62a88 commit f29af02
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion ConvertOneNote2MarkDown-v2.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ $notesdestpath = Read-Host -Prompt "Entry"
"1: Discard intermediate .docx files - Default"
"2: Keep .docx files"
[int] $keepdocx = Read-Host -Prompt "Entry"

""
"-----------------------------------------------"
# prompt for prefix vs subfolders
"1: Create folders for subpages (e.g. Page\Subpage.md)- Default"
"2: Add prefixes for subpages (e.g. Page_Subpage.md)"
Expand Down Expand Up @@ -388,6 +389,42 @@ if (Test-Path -Path $notesdestpath) {
New-Item -Path "$($notesdestpath)\$($notebookFileName)\$($sectiongroupFileName1)" -Name "$($sectiongroupFileName2)" -ItemType "directory" -ErrorAction SilentlyContinue
$sectiongroupFilePath2 = "$($notesdestpath)\$($notebookFileName)\$($sectiongroupFileName1)\$($sectiongroupFileName2)"
ProcessSections $sectiongroup2 $sectiongroupFilePath2

#start looping through any 2nd level section groups within the 1st level section group
foreach ($sectiongroup3 in $sectiongroup2.SectionGroup) {
$levelsfromroot = 3
if ($sectiongroup3.isRecycleBin -ne 'true') {
"### " + $sectiongroup3.Name
$sectiongroupFileName3 = "$($sectiongroup3.Name)" | Remove-InvalidFileNameChars
New-Item -Path "$($notesdestpath)\$($notebookFileName)\$($sectiongroupFileName1)\$($sectiongroupFileName2)" -Name "$($sectiongroupFileName3)" -ItemType "directory" -ErrorAction SilentlyContinue
$sectiongroupFilePath3 = "$($notesdestpath)\$($notebookFileName)\$($sectiongroupFileName1)\$($sectiongroupFileName2)\$($sectiongroupFileName3)"
ProcessSections $sectiongroup3 $sectiongroupFilePath3

#start looping through any 2nd level section groups within the 1st level section group
foreach ($sectiongroup4 in $sectiongroup3.SectionGroup) {
$levelsfromroot = 4
if ($sectiongroup4.isRecycleBin -ne 'true') {
"#### " + $sectiongroup4.Name
$sectiongroupFileName4 = "$($sectiongroup4.Name)" | Remove-InvalidFileNameChars
New-Item -Path "$($notesdestpath)\$($notebookFileName)\$($sectiongroupFileName1)\$($sectiongroupFileName2)\$($sectiongroupFileName3)" -Name "$($sectiongroupFileName4)" -ItemType "directory" -ErrorAction SilentlyContinue
$sectiongroupFilePath4 = "$($notesdestpath)\$($notebookFileName)\$($sectiongroupFileName1)\$($sectiongroupFileName2)\$($sectiongroupFileName3)\$($sectiongroupFileName4)"
ProcessSections $sectiongroup4 $sectiongroupFilePath4

#start looping through any 2nd level section groups within the 1st level section group
foreach ($sectiongroup5 in $sectiongroup4.SectionGroup) {
$levelsfromroot = 5
if ($sectiongroup5.isRecycleBin -ne 'true') {
"#### " + $sectiongroup5.Name
$sectiongroupFileName5 = "$($sectiongroup5.Name)" | Remove-InvalidFileNameChars
New-Item -Path "$($notesdestpath)\$($notebookFileName)\$($sectiongroupFileName1)\$($sectiongroupFileName2)\$($sectiongroupFileName3)\$($sectiongroupFileName4)" -Name "$($sectiongroupFileName5)" -ItemType "directory" -ErrorAction SilentlyContinue
$sectiongroupFilePath5 = "$($notesdestpath)\$($notebookFileName)\$($sectiongroupFileName1)\$($sectiongroupFileName2)\$($sectiongroupFileName3)\$($sectiongroupFileName4)\\$($sectiongroupFileName5)"
ProcessSections $sectiongroup5 $sectiongroupFilePath5
}
}
}
}
}
}
}
}
}
Expand Down

0 comments on commit f29af02

Please sign in to comment.