There are many customers who have had problems with their shared hosting being limited by file and resource usage.
Some hosting allows you to use 300,000 files, 600,000 files, or a specific number of files, such as a2hosting, hostmonter, bluehost, justhost...
If the threshold is exceeded, your website will not be able to work, forcing you to delete unnecessary files.
In this article, I will guide you through a few ways for your reference.
Normally, Magento 2 default will use many image types, it is configured in the view.xml file (app/design/VENDOR_DIR/THEME/etc/view.xml).
These image types will generate a directory containing images. Sometimes image folders are generated but are not necessary for your website, so it will be very resource-consuming.
So how can you remove unnecessary folders?
Tip 1: You can delete unnecessary attributes
Store > Attribute Set > Attribute Set Name (for e.g: Default)
You can remove image types that are not necessary for your website, for example: swatch_image, thumbnail, etc.
Tip 2: Modules can use only one image_type
For example: Related Products, Up-Sells, Cross-Sells
Change $image in Magento_Catalog/templates/product/list/items.phtml
$image = 'related_products_list';
$image = 'upsell_products_list';
$image = 'cart_cross_sell_products';
$image = 'new_products_content_widget_grid';
You can change it so that all $image, it will be $image= related_products_list
In addition, you can find other image types in the modules Magento_Review, Magento_Wishlist. Of course, you can also replace those image types with related_products_list
This way, you will limit the number of image files created and save resources when using Shared Hosting.