Clearing garbage from a specific folder with batch script loop

  Kiến thức lập trình

I want to clear some unnecessary file from the folder with .bat file, but the solution i came up with doesn’t seem to work.

So my code is as follows:

@echo off

set "folder_to_clean=D:Eurostag_work_folderschema"
set "file_types=*.tmp *.out *.bak"

echo Cleaning folder: %folder_to_clean%
echo Deleting files of types: %file_types%

for %%f in (%file_types%) do (
    echo Deleting files...
    del /q /f "%folder_to_clean%%%f"
)

echo Cleanup complete!

:end
pause

What’s wrong with it?

5

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT