Removing Entire Directory Subtrees

It is possible to remove a directory and all its existing files and subdirectories (that is, the whole directory subtree) in one command. However, this command is very powerful and hence very dangerous, and it must be typed in very carefully to avoid tragedy.

Warning: Great Disaster Potential

Even experienced UNIX users have accidentally misused the rm -r command and deleted the wrong files. This command can obliterate thousands of files in an instant. There is no way to get them back. Beginners should not use this procedure to remove entire directory subtrees. It is too dangerous. Take the slow, safe route of deleting each subdirectory one at a time, as described previously.

Removing Entire Directory Subtrees ...

Get Practical UNIX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.