skip to Main Content

How to fix error with this message when I click to button “Clean the Catalog Images Cache File”:

The directory
“/var/www/html/project-community-edition/pub/media/catalog/product/cache/d08a1eb7b61352ea219ec60a4090e56e/h/t”
cannot be deleted
Warning!rmdir(/var/www/html/project-community-edition/pub/media/catalog/product/cache/d08a1eb7b61352ea219ec60a4090e56e/h/t):
Directory not empty

3

Answers


  1. That is strange, I imagine you don’t care about the contents of the cache, have you tried giving the folder the right permissions? Those the user for Admin panel have the rights to flush?

    Login or Signup to reply.
  2. This issue of Permission

    sudo rm -rf pub/static/frontend/ pub/static/adminhtml/ pub/static/_requirejs pub/static/deployed_version.txt var/cache var/page_cache var/generation var/view_preprocessed var/session generated/code
    
    sudo php bin/magento setup:upgrade
    
    sudo php bin/magento setup:static-content:deploy en_US -f
    
    sudo php bin/magento indexer:reindex
    
    sudo php bin/magento cache:flush 
    

    Under Your Project Folder Run This Command :-

    sudo chmod -R 0777 generated/ pub/ var/ app/etc/
    
    Login or Signup to reply.
  3. This is not a permissions problem.

    It happens when you clean the cache on a site that has active visitors.

    Magento scans the cache directories for images, then deletes the images it found, then deletes the directory.

    The process that leads to the error is:

    • Magento scans a directory and finds a lot of files
    • Magento starts deleting them
    • a visitor accesses a product with an already deleted image
    • Magento creates a cached image file for this product
    • after deleting all the files from the directory, Magento tries to delete the directory, but the newly created image file is still there – and as it’s not possible to delete a directory that is not empty, the error is thrown
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search