Skip to content

Fastest way to load category and save programmatically in Magento 2

I want to load all collection in Magento 2 and save one by one programmatically. is there any faster way to do so.

I tried below code for one category

use MagentoFrameworkAppBootstrap;
include('app/bootstrap.php');
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$category = $objectManager->create('MagentoCatalogModelCategoryFactory')->create()->setStoreId(0)->load(17);
$category->save();