V
V
Vinkersa2021-11-10 10:32:57
cmd/bat
Vinkersa, 2021-11-10 10:32:57

How to delete all subfolders (cmd)?

Hey everyone

Here's a cmd question.
Let's say if I need to delete all files in a folder and subfolders, I can use del /s path. To delete a folder and all folder contents I can use rd /s path.
In the first case, I can delete everything from where I am, like del /s *, but this does not work with rd.

How can I delete all the folders with all the information in them, in the directory I'm currently in?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wisgest, 2021-11-10
@wisgest

If we are not talking about deleting the directory itself, use a loop with the /D: key ( doubled in the batch file ).
for /d %d in (*) do rd /s "%d"
%

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question