Delete Index Files.cmd

 

@echo off

echo Delete Index Files.

echo.


set /a drive=0

set /a exc=0

set /a includes=0

set /a includes_mac=0


vol c:

echo.

vol d:

echo.

vol e:

echo.

vol f:

echo.

vol g:

echo.


echo *Be careful if use on C:.

echo.


set /p drive="Drive Name: "

%drive%:

cd \

echo.

vol

echo.


set /p exc="Start? Y/N: "

echo.


if /i %exc%==n echo Aborting delete index files.

if /i %exc%==n timeout 3

if /i %exc%==n exit


set /p includes="Delete all Desktop.ini files too? Y/N: "

echo.

set /p includes_mac="Delete all macOS index files too? Y/N: "

echo.


del /s /q /f /a:r /a:s /a:h /a:a Thumbs.db

del /s /q /f /a:r /a:s /a:h /a:a *.$data.Zone.Identifier

del /s /q /f /a:r /a:s /a:h /a:a *.$data.Mac_Metadata

rmdir /s /q "System Volume Information"


if /i not %includes%==n del /s /q /f /a:r /a:s /a:h /a:a Desktop.ini


if /i not %includes_mac%==n del /s /q /f /a:r /a:s /a:h /a:a ._*

if /i not %includes_mac%==n del /s /q /f /a:r /a:s /a:h /a:a .com.*

if /i not %includes_mac%==n del /s /q /f /a:r /a:s /a:h /a:a .DS_Store

if /i not %includes_mac%==n rmdir /s /q .fseventsd

if /i not %includes_mac%==n rmdir /s /q .Spotlight-V100

if /i not %includes_mac%==n rmdir /s /q .TemporaryItems

if /i not %includes_mac%==n rmdir /s /q .Trashes


timeout 10


DeleteIndexFiles.cmd