Salesforce auto-create folders for all Account?

This is batch class use to auto-create folder for account .

global class autofolderCreator implements Database.Batchable<sObject>,Database.Stateful,Database.AllowsCallouts{

global Map<String,String> boxFmap = new Map<String,String>();

global autofolderCreator(){ }

global Database.QueryLocator start(Database.BatchableContext BC){

// this loop use to map existing folder with account so prevent for duplication.

for(box__Folder_Meta__c mp :[select id,name,box__Folder_Id__c ,box__Folder_Name__c,box__Folder_Share_Link__c from box__Folder_Meta__c limit 9999]){



String query = ‘Select id,name from account’; return Database.getQueryLocator(query);


global void execute(Database.BatchableContext BC, List<Account> scope){

box.Toolkit boxToolkit ;

for(Account a : scope){


boxToolkit = new box.Toolkit(); String accountFolderId = boxToolkit.createFolderForRecordId(, null, true);





global void finish(Database.BatchableContext BC){ }

},Auto create folder for account.