59.9k views
4 votes
John needs to remove the subdirectory named temp2 as well as all of the files that it contains. Which of the following commands could John use to accomplish this task in one step?

a. del temp2 b. rm -r temp2 c. rmdir -r temp2 d. rmdir temp2

User Elvikingo
by
8.3k points

1 Answer

2 votes

Answer:

Use rmdir -r to remove a subdirectory and all its contents.

Step-by-step explanation:

Simply using rmdir will remove the subdirectory only if it is empty.

del is for removing one or more files, not sub/parent directories.

User Alketa
by
7.8k points