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.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
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/"
I found a great article while googling, i recommend it.
Before deleting file ensure that you want to delete it really - if needed, make a back up copy.
1] With SSH use the following command to enter the directory where the file(you want to delete) is located:
2] After going to the particular folder use the following command(s):
To delete a single file:
rm readme.txt (Example to deleting readme.txt file)
To delete entire files of the folder after you entered the directory using the command mentioned in STEP 1 - use the following command:
rm -r *
NOTE: STEP 2 is irreversible if you don't create any back up.