-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathclean_MKV_data.bat
More file actions
63 lines (49 loc) · 2.09 KB
/
Copy pathclean_MKV_data.bat
File metadata and controls
63 lines (49 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
:: Purpose: Cleans all metadata off supported media files (typically MKV)
:: Requirements: Edit the script to specify location of mkvpropedit.exe and the directory to clean. Operates recursively.
:: Author: reddit.com/user/vocatus ( vocatus.gate at gmail ) // PGP key: 0x07d1490f82a211a2
:: Version: 1.0.1 + Add function to call PowerShell and get date into ISO standard format
:: + Create log directory if it doesn't exist
:: 1.0.0 + Initial write
:::::::::::::::
:: VARIABLES :: ---- Set these to your desired values. The defaults should work fine though ------ ::
:::::::::::::::
:: Rules for variables:
:: * NO quotes! (bad: "c:\directory\path" )
:: * NO trailing slashes on the path! (bad: c:\directory\ )
:: * Spaces are okay (okay: c:\my folder\with spaces )
:: * Network paths are okay (okay: \\server\share name )
:: ( \\172.16.1.5\share name )
:: Log settings
set LOGPATH=%SystemDrive%\logs
set LOGFILE=%COMPUTERNAME%_clean_MKV_data.log
if not exist "%LOGPATH%" mkdir "%LOGPATH%" >nul
:: Set these variables
set MKVPROPEDIT=R:\utilities\cli_utils\mkvpropedit.exe
set TARGETDIR=\\server\share
:::::::::::::::::::::
:: PREP AND CHECKS ::
:::::::::::::::::::::
@echo off && cls
set SCRIPT_VERSION=1.0.1
set SCRIPT_UPDATED=2026-09-27
call set_cur_date
title Clean MKV Data v%SCRIPT_VERSION% (%SCRIPT_UPDATED%)
:::::::::::::
:: EXECUTE ::
:::::::::::::
pushd "%TARGETDIR%"
for /r %%i in (*.mkv,*.webm,*.mp4) do (
echo %CUR_DATE% Processing "%%i"
echo %CUR_DATE% Processing "%%i" >> "%LOGPATH%\%LOGFILE%" 2>NUL
"%MKVPROPEDIT%" "%%i" -d title >> "%LOGPATH%\%LOGFILE%" 2>NUL
)
popd
pause
:::::::::::::::
:: FUNCTIONS ::
:::::::::::::::
:: Get the date into ISO 8601 standard format (yyyy-mm-dd) so we can use it
:set_cur_date
for /f %%a in ('powershell -NoProfile -Command "$d = Get-Date; $d.ToString(\"yyyyMMddHHmmss.fff\") + $d.ToString(\"zzz\").Replace(\":\",\"\")"') DO set DTS=%%a
set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2%
goto :eof