Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a VPS. I want to delete some specific folder inside. /var/BACKUP 01

I want to delete all files in BACKUP 01

How can I do it with SSH access? I'm using linux,please type a command here.

share|improve this question

migrated from serverfault.com May 31 '11 at 11:01

This question came from our site for professional system and network administrators.

3 Answers 3

To delete a file in Linux, you use the 'rm' command.

You need to be careful as you have a space in that directory name - Ideally, you should name your directories and files with no spaces in the names. It's not mandatory to do this, but it makes life easier, and is less prone to accidentally deleting something. If there are spaces in the filename, it's best to use quotes around the name.

rm -fr "/var/BACKUP 01/"

If you want to see what files this will delete before you run it you could use this command

ls "/var/BACKUP 01/"
share|improve this answer
2  
ls -r "/var/BACKUP 01/*" would recursively list the directories, just as rm -r recursively removes them. –  stib May 31 '11 at 11:16
2  
Do not use * inside quotes (unless you have a file named * in there). Just give the directory name. –  grawity May 31 '11 at 18:30
    
@grawity - good catch - I've edited the post. –  barryj May 31 '11 at 18:56
    
Oh, don't use it outside the quotes either. It would miss .dotfiles, and given many files it might even cause a "Command line too long" error. Just give the directory name. –  grawity May 31 '11 at 18:58
    
@grawity Another good point. I was focussing on deleting the contents of the directory, but not the directory, which I think is what was asked for. A find with a -delete option might be better for that I guess - put probably overkill for what the OP wanted. –  barryj May 31 '11 at 19:03

If you are logged in to your VPS then

cd "/var/BACKUP 01"
rm -r *

should do the trick. You need to put quotes around the path because of the space in the BACKUP 01 directory name.

share|improve this answer

I found a great article while googling, i recommend it.

http://www.discusswire.com/delete-entire-directory-ssh/

share|improve this answer
2  
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  Ivo Flipse Apr 25 '12 at 12:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.