I am generating a lot of sitecore content items programmatically in a tree structure. To provide an example, the structure looks something like this in content tree:
Sitecore
content
Item1
SubFolder1 (containing thousands of subitems)
Item2
SubFolder2 (containing thousands of subitems)
...and so on
Now, all the subitems within Subfolder1 use the same template, similarly other SubFolders too. I want to make all the Subfolders bucketable programmatically. I know how to do this using Sitecore UI but that's not practical in this case as there will be thousands of such subfolders. So, how do I do that programmatically?