cs-icon.svg

Bulk Delete Content Types and Assets

Contentstack's Bulk Delete Utility allows you to perform bulk delete operations. That means, that it is possible to delete all content types or a specific content type(s), and all assets in just one operation.

In this document, we will look at the steps for using this Bulk Delete Utility.

  1. Download and Install the Utility

    1. To perform bulk delete operations on all or specific content types and all assets, you need to first download the "contentstack-bulk-delete" utility from GitHub. This utility consists of modules that will help you to perform the desired operations. 
    2. Move inside your project directory and install the required npm dependencies as follows:
      npm install
      
  2. Make Configuration Changes

    Open the config file from the project that you downloaded in the above step and open the index.js file:

    {
     master_locale: {
      name: ''// Stack's master locale. ex: 'English - United States'
      code: ''''  // Stack master locale's code. ex: 'en-us'
     },
     email: '''', // Your registered email id
     password: '''', // Account password
     source_stack: '''' // Stack api_key
     content_types_list:[], // Specify specific content types in array eg: ['product', 'category']
      assetsdelete: ''''//Bollean value, Example: true or false 
     ...
    }
    
  3. Use the contentstack-bulk-delete Utility

    After you have made the changes to your project's config file, the next step is to use the utility to delete a specific module (content type or assets). 

    Stay in your project directory and execute the following command:

    npm run delete-assets
    npm run delete-contenttypes
    npm run start
    

Note: Your empty assets folders will not be deleted by the utility.

Was this article helpful?
^