Last active
July 15, 2020 10:18
-
-
Save nandini-menon/f8aed9c97d939430156138314510cc09 to your computer and use it in GitHub Desktop.
Auto Creation of OneNote Notebooks
This file contains 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
@echo off | |
for /d %%i in (Folder_Creation\*) do ( | |
OneNoteCLI.exe importfolder -n "%%i" -r -d -p "%%i" | |
) |
This file contains 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
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