Skip to content

Latest commit

 

History

History
39 lines (35 loc) · 1.01 KB

File metadata and controls

39 lines (35 loc) · 1.01 KB

Purpose

Downloaded ebook files (.rar/.zip) usually contain multiple formats: pdf, epub, mobi. This batch script could be used to generate another batch script to remove all .mobi files if there is a .epub file with the same name, as well as .epub files if there is .pdf file.

Usage

  1. Open ebook folder, copy _find_dup.bat to there.
  2. Open cmd
  3. Run _find_dup.bat > _del_dup.bat
  4. Check before run _del_dup.bat

Script

Save this as _find_dup.bat

@echo OFF
For /F "tokens=*" %%G in ('dir /b *.azw3') do (
    if exist "%%~dpnG.mobi" or exist "%%~dpnG.epub" or exist "%%~dpnG.pdf" (
		@echo ON
        echo del "%%~dpnxG"
		@echo OFF
    )
)
For /F "tokens=*" %%G in ('dir /b *.mobi') do (
    if exist "%%~dpnG.epub" or exist "%%~dpnG.pdf" (
		@echo ON
        echo del "%%~dpnxG"
		@echo OFF
    )
)
For /F "tokens=*" %%G in ('dir /b *.epub') do (
	if exist "%%~dpnG.pdf" (
		@echo ON
        echo del "%%~dpnxG"
		@echo OFF
    )
)
@echo ON