Quick Answer: How Do I Delete All Files and Subdirectories in a Directory in Linux?
Contents

How remove all files and subdirectories in Linux?

Open the terminal application. To delete everything in a directory run: rm /path/to/dir/* To remove all sub-directories and files: rm -r /path/to/dir/*
…
Understanding rm command option that deleted all files in a directory

  1. -r : Remove directories and their contents recursively.
  2. -f : Force option. …
  3. -v : Verbose option.

What is the command to delete all files and subdirectories?

Run the command RMDIR /Q/S foldername to delete the folder and all of its subfolders.

Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article
Twitter Facebook Pinterest