I\'m trying to make a batch file on Windows for deleting all the files in the current directory but excluding 4 file extensions (log, sdb, SDK, bat).
I have tried th
If ROBOCOPY is available to you:
@ECHO OFF
MKDIR temporary_pit
ROBOCOPY . temporary_pit /XF *.sdb *.sbk *.log *.bat /MOV >NUL
RMDIR /S /Q temporary_pit
That is, you are creating a temporary subdirectory, moving the files that are to be deleted to it (which is fast because, as the destination directory is on the same drive, only file names are relocated, not the files' contents), then deleting the subdirectory.