Skip to content

Instantly share code, notes, and snippets.

@cneud
Created April 18, 2014 15:11
Show Gist options
  • Save cneud/11049141 to your computer and use it in GitHub Desktop.
Save cneud/11049141 to your computer and use it in GitHub Desktop.
Batch script for cleaning of data transfer directories in Europeana Newspapers
@ECHO OFF
REM recursively traverse through directories and delete all instances of JPG|PNG|TIF|JP2 image files
CHOICE /C:12345 /M "Really delete all images of type (1) JPG, (2) JP2, (3) TIF, (4) PNG or (5) Cancel?"
IF ERRORLEVEL 5 GOTO Cancel
IF ERRORLEVEL 4 GOTO PNG
IF ERRORLEVEL 3 GOTO TIF
IF ERRORLEVEL 2 GOTO JP2
IF ERRORLEVEL 1 GOTO JPG
GOTO END
:JPG
ECHO.
ECHO Please wait while all JPG images are being deleted...
FOR /R %%i IN (.\*.JPG) DO DEL /S /Q "%%i"
ECHO Done!
GOTO END
:PNG
ECHO.
ECHO Please wait while all PNG images are being deleted...
FOR /R %%i IN (.\*.PNG) DO DEL /S /Q "%%i"
ECHO Done!
GOTO END
:TIF
ECHO.
ECHO Please wait while all TIF images are being deleted...
FOR /R %%i IN (.\*.TIF) DO DEL /S /Q "%%i"
ECHO Done!
GOTO END
:JP2
ECHO.
ECHO Please wait while all JP2 images are being deleted...
FOR /R %%i IN (.\*.JP2) DO DEL /S /Q "%%i"
ECHO Done!
GOTO END
:Cancel
GOTO END
:END
@PAUSE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment