Delete millions, large number of files on FTP / SFTP / FTPS server, like in hetzner storage box

of course better option than deleting millions of files would be to use rm -r system command or unmount specific directory, but sometimes you don’t have such access, in that case you can use `lftp` command line in example bellow

it would be faster to use lftp rather than midnight commander or other GUI ftp client, because lftp executed via command line would be faster

nohup lftp -u ENTER_USERNAME_HERE,ENTER_PASS_HERE sftp://ENTER_USERNAME_HERE.your-storagebox.de:/home/ -p 23 -e "rm -r /home/ENTER_DIRECTORY_TO_DELETE_HERE" &

nohup is used so that process won’t stop when you log out or connection is closed, this is important because deleting millions of files, one by one using this method could take days

sometimes you can encounter problems with permissions, to fix this you can change invalid permissions using chmod:

nohup lftp -u ENTER_USERNAME_HERE,ENTER_PASS_HERE sftp://ENTER_USERNAME_HERE.your-storagebox.de:/home/ -p 23 -e "chmod -R 770 /home/ENTER_DIRECTORY_TO_DELETE_HERE" &