How to remove multiple directories?

QuestionsQuestions8 SkillsProBasic Files OperationsAug, 31 2025
093

To remove multiple directories at once, you can list the directory names after the rm -r command, separated by spaces. Here’s how to do it:

rm -r directory1 directory2 directory3

This command will recursively delete directory1, directory2, and directory3, along with all their contents.

If you want to be prompted for confirmation before each deletion, you can add the -i option:

rm -ri directory1 directory2 directory3

Caution: Ensure you double-check the directory names before executing the command, as deletions are permanent. If you have any more questions, feel free to ask!

0 Comments

no data
Be the first to share your comment!