How to delete non-empty directory?

QuestionsQuestions8 SkillsProBasic Files OperationsDec, 09 2025
074

To delete a non-empty directory, you can use the rm command with the -r (recursive) option. Here’s the syntax:

rm -r /path/to/non-empty-directory

If you want to force the deletion without being prompted for confirmation, you can add the -f option:

rm -rf /path/to/non-empty-directory

Replace /path/to/non-empty-directory with the actual path of the directory you want to delete. Be cautious when using this command, as it will permanently delete the directory and all its contents.

0 Comments

no data
Be the first to share your comment!