Topic: Deleting folders via SFTP
Hello,
I hope someone can help me, Google couldn't. I'm writing a backup script in Ruby and face now a problem deleting old folders.
This is my code right now:
if existing_backups.size > NO_OF_BACKUPS
sftp.rmdir("/home/#{SSH_USER}/#{BACKUP_ROOT}/" + existing_backups[0].name)
backup_deleted = true
existing_backups.popI have a sorted array with all existing backups and now i want to delete a backup if the NO_OF_BACKUPS is exceeded. The code won't throw an exception or an error, it simply won't delete the folder. Could someone please tell me, what I am doing wrong?? How can I delete a non-empty folder on my server using Ruby??
Thanks a lot, I'm getting crazy for hours with this problem...