If we have a moodle installed, a very interesting method to delete all caches is to use system console. To do that, we have to go to our moodle route and execute:
php admin/cli/purge_caches.php
Best regards!
php admin/cli/purge_caches.php
#!/bin/bash
PATHFROM = "/.../..." # folder to create backup
PATHTO = "/.../..." # path of the hard disk
rsync -av --exclude={"*chat*","*library*"} $PATHFROM $PATHTO