If you are using Hetzner storage boxes and need to delete a folder containing a large number of files, then use the command below to remotely connect and delete your folders.
At JUCRA, we use this command to delete incremental backup folders created by JetBackup, which can contain millions of files.
NOTE 1: If you have a lot of files in the folder, the deletion process can take a while. For example, deleting 5TB of data can take 3 days and the terminal window does not provide feedback apart from when the process is completed.
NOTE 2: The files sitting on the storage box, need to have 0755 permissions, so when you are uploading, ensure that they are uploading with 0755, otherwise you will have to manually set the permissions, and that can take a long time, maybe days.
NOTE 3: Make sure the <folder/path-to-delete> is CORRECT, rsync is unforgiving and a mistake in the path can cause deletion of the wrong files.
So do as follows
1. Open Terminal on your local machine
2. Run the first command "mkdir emtpy-folder" so that it creates a folder on your local drive called "emtpy-folder"
3. Run the rsync command obviously replacing the <HOST/IP> part with your storage box address and the <folder/path-to-delete> with the path to your folder on the storage box.
-----------------%<----------------- mkdir emtpy-folder rsync -e 'ssh -p23' --recursive --delete emtpy-folder/ <HOST/IP>:<folder/path-to-delete> -----------------%<-----------------