I'm trying to create a batch file that will do the following:
- Read the contents of a particular source directory
- Determine if the contents are audio or video file(s)
- Determine if the contents are of a particular file type (audio or video) and run a file conversion program based on the determined file type
- example: for audio files): if the file type is m4a, the program AVSAudioConverter is started using mp3 settings.xml.
- example: for video files): if the file type is mkv, the program AVSVideoConverter is started using the mkv to mp4 settings.xml.
- The converted result is saved to a different directory
- The source file is moved to a third directory on conversion completion
- The Filebot program is started to move the file to media directory based on its own sort script
- The batch file resumes & repeats until the source directory has been emptied
- The entire process is appended to a conversion log
Code: Select all
@echo off
setlocal enabledelayedexpansion enableextensions
rem set variables
set workdir=D:\Downloads\Video
:F1
if exist %workdir%\*.avi ( echo convert avi ) && ( goto AVI ) else ( echo no *.avi file to process )
:F2
if exist %workdir%\*.flv ( goto FLV ) else ( echo no *.flv file to process )
:F3
if exist %workdir%\*.mkv ( goto MKV ) else ( echo no *.mkv file to process )
:F4
if exist %workdir%\*.mov ( goto MOV ) else ( echo no *.mov file to process )
:F5
if exist %workdir%\*.mp4 ( goto FILEBOT ) else ( echo no *.mp4 file to process )
:F6
if exist %workdir%\*.wmv ( goto WMV ) else ( echo no *.wmv file to process )
goto END
:FILEBOT
rem filebot -script fn:amc --output "x:/media" --action duplicate --conflict skip -non-strict --log-file amc.log --def unsorted=y music=y artwork=y "ut_label=%l" "ut_state=%s" "ut_title=%n" "ut_kind=%k" "ut_file=%f" "ut_dir=%d"
goto END
:AVI
start "" "C:\Program Files (x86)\AVS4YOU\AVSVideoConverter\AVSVideoConverter.exe" -a "D:\Documents\Conversions\avi-to-mp4.xml"
move *.avi %workdir%\Processed\
goto F2
:FLV
start "" "C:\Program Files (x86)\AVS4YOU\AVSVideoConverter\AVSVideoConverter.exe" -a "D:\Documents\Conversions\flv-to-mp4.xml"
move *.flv %workdir%\Processed\
goto F3
:MKV
start "" "C:\Program Files (x86)\AVS4YOU\AVSVideoConverter\AVSVideoConverter.exe" -a "D:\Documents\Conversions\mkv-to-mp4.xml"
move *.mkv %workdir%\Processed\
goto F4
:MOV
start "" "C:\Program Files (x86)\AVS4YOU\AVSVideoConverter\AVSVideoConverter.exe" -a "D:\Documents\Conversions\mov-to-mp4.xml"
move *.mov %workdir%\Processed\
goto F5
:WMV
start "" "C:\Program Files (x86)\AVS4YOU\AVSVideoConverter\AVSVideoConverter.exe" -a "D:\Documents\Conversions\wmv-to-mp4.xml"
move *.wmv %workdir%\Processed\
goto F6
:END
Code: Select all
@echo off
setlocal enabledelayedexpansion enableextensions
rem set variables
set workdir=D:\Downloads\Video
if exist %workdir%\*.avi ( echo convert avi ) && ( goto AVI ) else ( echo no *.avi file to process )
start "" "C:\Program Files (x86)\AVS4YOU\AVSVideoConverter\AVSVideoConverter.exe" -a "D:\Documents\Conversions\avi-to-mp4.xml"
move *.avi %workdir%\Processed\
Also, here is the info.bat contents:
Code: Select all
INFO.BAT version 1.5 -------------------------------------------------------------------------------- Windows version : Microsoft Windows [Version 10.0.19042.1052] Product name : Windows 10 Pro, 64 bit Performance indicators : Processor Cores: 8 Visible RAM: 33466316 kilobytes Date/Time format : (mm/dd/yy) Mon 07/05/2021 22:37:54.87 __APPDIR__ : C:\Windows\system32\ ComSpec : C:\Windows\system32\cmd.exe PathExt : .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC Extensions : system: Enabled user: Disabled Delayed expansion : system: Disabled user: Disabled Locale name : en-US Code Pages: OEM 437 ANSI 1252 DIR format : 07/05/2021 05:54 PM 5,100,273,664 pagefile.sys Permissions : Elevated Admin=Yes, Admin group=Yes Missing from the tool collection: debug