import os root_dir = r"c:\Users\joao.goncalves\Desktop\manuais zammad" structure = { "documentacao rede e seguranca": ["pfsense"], "documentacao storage": ["truenas", "samba", "nfs", "iscsi"], "documentacao bancos de dados": ["postgresql", "mysql"], "documentacao windows": ["active directory", "dns", "firewall", "gpo"], "documentacao linux": ["ubuntu", "debian", "alpine"], "documentacao virtualizacao": ["proxmox"], "documentacao conteineres": ["docker", "docker-compose", "portainer"], "documentacao aplicativos": ["gitea", "zammad", "zabbix", "technium", "magnusbilling", "asterisk"], "documentacao navegadores": ["google chrome", "firefox"], "documentacao ferramentas": ["putty", "ssh"] } for category, subitems in structure.items(): cat_path = os.path.join(root_dir, category) if not os.path.exists(cat_path): os.makedirs(cat_path) print(f"Created category: {category}") # Create category README with open(os.path.join(cat_path, "README.md"), "w", encoding="utf-8") as f: f.write(f"# {category.replace('documentacao ', '').title()}\n\nManuais relacionados a {category.replace('documentacao ', '')}.\n") for item in subitems: # Create subdirectories for each item to keep it clean, or just keep them in the category? # The user's list is long. Specific folders for each item is better for organization. item_slug = item.replace(" ", "_") item_path = os.path.join(cat_path, item_slug) if not os.path.exists(item_path): os.makedirs(item_path) print(f" Created item: {item}") with open(os.path.join(item_path, "README.md"), "w", encoding="utf-8") as f: f.write(f"# Documentação {item.title()}\n\nLocal para manuais e procedimentos referentes ao **{item.title()}**.\n") print("Directory structure created successfully.")