How to remove directory with all of its contents?
Solution 1
If you don't want to empty the directory first, you can use
rm -r
to recursively remove directories and their content.
Please note also that this is already explained in the documentation.
rmdir
: Thermdir
command will delete an empty directory. To delete a directory and all of its contents recursively, userm -r
instead.
Since you are not an expert, I suggest that you read carefully that documentation page before using more the terminal, before you do some damage to your files!
Solution 2
If you want to remove an entire directory with everything in it, you can use rm -r
like dadexix said
and if you really want to make sure add the f for force
rm -rf
i Always do that and it Always works
Related videos on Youtube
user3076763
Updated on September 18, 2022Comments
-
user3076763 over 1 year
I tried to remove a directory by using command
rmdir
but I got this answer:The directory is not empty.
How to deal with such problems?
-
Twinkles almost 8 yearsPlease be careful: not using -rf habitually has saved me several times from doing something disastrous.