R
R
Roman Rakzin2020-07-18 20:11:38
cmd/bat
Roman Rakzin, 2020-07-18 20:11:38

How to recursively delete a specific folder in a directory?

There are a lot of projects with folders that need to be removed (node_modules for example).
How to recursively delete a specific folder in all subfolders using node or cmd commands?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
inFureal, 2020-07-18
@inFureal

fs.rmdirSync(dir, { recursive: true });

M
m4xD, 2020-07-18
@m4xxD

for /f "delims=" %%a in ('dir /b /A:D * ^|find "pattern"') do rmdir /s /q "%%a"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question