Skip to content

Instantly share code, notes, and snippets.

@nandini-menon
Last active July 15, 2020 10:18
Show Gist options
  • Save nandini-menon/f8aed9c97d939430156138314510cc09 to your computer and use it in GitHub Desktop.
Save nandini-menon/f8aed9c97d939430156138314510cc09 to your computer and use it in GitHub Desktop.
Auto Creation of OneNote Notebooks
@echo off
for /d %%i in (Folder_Creation\*) do (
OneNoteCLI.exe importfolder -n "%%i" -r -d -p "%%i"
)
import os
def main():
n = (int)(input('No. of Notebooks: '))
os.chdir('Folder_Creation')
for i in range(n):
note_name = 'Note_' + str(i+1)
try:
os.makedirs(note_name)
os.chdir(note_name)
for j in range(20):
section_name = 'Section_' + str(j+1)
os.mkdir(section_name)
os.chdir(section_name)
for k in range(50):
page_name = 'Page_' + str(k+1) + '.txt'
text_file = open(page_name, "w")
text_file.write(f'This is:-\n\tpage {k+1}\n\tof\n\tSection {j+1}\n\tin\n\tNotebook {i+1}')
text_file.close()
os.chdir('..')
os.chdir('..')
except OSError:
print('Directory creation failed')
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment