Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ECHO OFF
- CLS
- SetLocal EnableDelayedExpansion
- REM Find TV Show Subdirectories
- IF EXIST %UserProfile%\Downloads\*hdtv* (
- FOR /F "tokens=* delims= " %%i IN ('DIR %UserProfile%\Downloads\*hdtv* /ad/b') DO (
- REM If there are rar files, unrar them into the downloads directory
- IF EXIST %%i\*.rar (
- "C:\%ProgramFiles%\7-Zip\7z" e "%%i\*.rar" -o%UserProfile%\Downloads
- ECHO.
- REM Error handling so that unextracted files aren't deleted
- IF !ERRORLEVEL! NEQ 0 (
- ECHO Extraction Error in %%i
- ECHO.
- ) ELSE (
- REM Remove Subdirectory and Files
- RD "%%i" /S /Q
- )
- ) ELSE (
- REM If no rars, move video files to the downloads directory
- FOR %%j IN ( %%i\*.mkv %%i\*.avi) DO (
- IF %%j == "" (
- ECHO No Valid filetypes to Move
- ECHO.
- ) ELSE (
- MOVE /Y "%%i\%%j" %UserProfile%\Downloads
- ECHO.
- REM Error handling so that unmoved files aren't deleted
- IF !ERRORLEVEL! NEQ 0 (
- ECHO Move %%~xj Error in %%i
- ECHO.
- ) ELSE (
- REM Remove Subdirectory and Files
- RD "%%i" /S /Q
- )
- )
- )
- )
- )
- ) ELSE (
- ECHO No Subdirectories With Files to Move or Extract
- ECHO.
- )
- REM Convert MKV to MP4 for easier streaming and better device support
- IF EXIST *.mkv (
- FOR %%v IN (*.mkv) DO (
- REM Timestamp for progress report
- ECHO Begin converting %%v at !TIME!
- ECHO.
- REM Use FFMpeg to copy audio and video streams into an MP4 container (plus some switches for limited verbosity)
- "%ProgramFiles(x86)%\ffmpeg\bin\ffmpeg.exe" -loglevel error -v 1 -i "%%v" -vcodec copy -acodec copy "%%~nv.mp4" >NUL
- ECHO.
- REM Error handling so unconverted files are not deleted
- if !ERRORLEVEL! NEQ 0 (
- ECHO Conversion Error on %%v
- ECHO.
- ) ELSE (
- REM Second timestamp for progress report
- ECHO %%~nv.mp4 complete at !time!
- ECHO.
- DEL "%%v"
- )
- )
- ) ELSE (
- ECHO No MKVs to Convert
- ECHO.
- )
- REM Check for files named with specific format to rename - e.g. Showname.s01e01.Showtitle.Resolution.Group.mp4
- IF EXIST *.s*.* (
- ECHO Renaming Files
- ECHO.
- "%ProgramFiles(x86)%\theRenamer\theRenamer" -fetch
- ) ELSE (
- ECHO Nothing to Rename
- ECHO.
- )
- PAUSE
- EndLocal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement