Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Unix command to delete two folders at once? Using rm -rf?

share|improve this question

migrated from Feb 8 '11 at 7:47

This question came from our site for professional and enthusiast programmers.

up vote 18 down vote accepted


rm -rf /path/to/folder1 /other/folder/in/different/place

The '-f' is not mandatory if you can write to each file and directory, or if you don't mind being asked lots of questions. The directories are deleted sequentially, but both are deleted as the result of a single command.

share|improve this answer
i don't know why i didn't just try this... – funk-shun Feb 7 '11 at 8:05

In bash, there is a way to insert a list of arguments with curly braces:

rm -rf /path/to/{folder1,folder2}
will run
rm -rf /path/to/folder1 /path/to/folder2

It can be inserted anywhere:

rm -rf /{folder1,folder2}/subfolder
will run
rm -rf /folder1/subfolder /folder2/subfolder
share|improve this answer
Its called "shell expansion" if anyone wants to look it up. – Sirex Feb 8 '11 at 11:09
so thats what its called! i tried to search it but couldnt even form a good search criteria. – kenny Feb 8 '11 at 11:13

If you want the deletion to actually be concurrent, which can be faster if they are on separate disks, but probably slower if they are on the same one:

rm -rf /path/to/folder1 &
rm -rf /other/folder/in/different/place
share|improve this answer
good point, although I was looking more for a quicker (lazier) way to delete two folders – funk-shun Feb 7 '11 at 8:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .