How to delete a directory through ssh

I’m trying to use SSH to delete a directory. It won’t delete via FTP.

I’ve tried variations of the below but nothing seems to work;

rm -f [folder]
rm /-f [folder]

the directory that should be deleted is, so I use that as the folder.



rm -r -f [folder]

nothing seems to work. i’m really new to ssh so it’s possible that I don’t know what I’m doing. i read up on the files but can’t seem to make sense of what is going wrong.

Are you the owner of the directory?


 ls -la 

Several columns will appear that list the directory contents, but also show the owner and the group of each file.

Something like

drwxr-xr-x  3 root root   4096 2008-06-16 13:15 .subversion

Here the owner of the directory .subversion is “root” and it’s also in the group “root” (3rd and 4th columns).

If you are not the owner of the directory, you are unable to delete it, unless you become root (which is probably not possible, because your hoster won’t give you the password :P)

Try this:

sudo rm -rf [foldername]

It will prompt you for the root password to execute the command. Be careful with this command though! There is no undoing it if you delete the wrong folder!