P
P
Pavel Sokolov2021-03-22 13:20:08
cmd/bat
Pavel Sokolov, 2021-03-22 13:20:08

How to delete a folder starting with a specific character?

I have a certain folder in which there is a set of folders, some of them are named number_number and number_-number, others are named -number_number and -number_-number. Folders contain files that must be deleted along with them. The folders of the second group (the name starts with -) are subject to deletion. How to do it?
PS: I have windows.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wisgest, 2021-03-22
@communistic_sistema

for /d %D in (-*) do rd /s /q "%D"
(when used in a batch file %D, replace with %%D)
- see help for FOR and RD commands:

for /?
rd /?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question