tsrein

batch-ffmpeg-emkts-1

Apr 5th, 2023
1,113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 19.57 KB | None | 0 0
  1. @echo off
  2. setlocal EnableDelayedExpansion
  3. :: Author: Rein Laaneser, 2023, CC: BY-SA
  4.  
  5.  
  6. REM ---------------------------------------------------
  7. REM
  8. REM  PREREQUIEMENTS
  9. REM
  10. REM ---------------------------------------------------
  11.  
  12.  
  13. :: FOLDERS AND FILES
  14. :: Zoom files are downloaded to root/folder/subfolder,
  15. :: download from zoom to subfolder is provided with separate sript/automation.
  16. :: Folder name includes 6 character course code and 2 character lang code
  17. ::   like this "RRT301 ET".
  18. :: Subfolder name includes zoom recoding date
  19. ::   like this "2023-01-21".
  20.  
  21.  
  22. :: changes to ver5
  23. :: Function Func_MoveToEdit is updated
  24.  
  25.  
  26. :: changes to ver6
  27. :: created functions Func_LogFile and Func_EncodeFFmpeg
  28.  
  29. :: changes to ver7
  30. :: 2 translation files Check
  31.  
  32. :: changes to ver8
  33. :: with two translations if one is same woks
  34. :: this means there is 2 different Language
  35. :: todo: 3 different language with 1 wihtout translaton and 2 with translation
  36.  
  37. :: ver 9
  38. :: With two translations testing works.
  39. :: Needs to be correted tested
  40. :: Needs to be optimize code, as original works twice same procedure.
  41.  
  42. :: ver 10
  43. :: testing with three translations
  44.  
  45. :: ver 11
  46. :: clean ver 10
  47. :: other same
  48.  
  49.  
  50.  
  51. REM ---------------------------------------------------
  52. REM
  53. REM  INITIAL VARIABLES
  54. REM
  55. REM ---------------------------------------------------
  56.  
  57. REM Source folders
  58. set root=I:\_2_DoCompose2
  59.  
  60. REM Encoded source folders
  61. set composed=I:\_3_Composed2
  62.  
  63. REM Encoded videos
  64. set editfolder=I:\_4_Edit
  65.  
  66. REM Images
  67. set images=I:\_Images
  68.  
  69.  
  70. REM ---------------------------------------------------
  71. REM
  72. REM   FOLDERS processing start
  73. REM
  74. REM ---------------------------------------------------
  75.  
  76. for /d %%a in ("%root%\*") do (
  77.     echo Processing folder %%a...
  78.    
  79.     REM folder name for arcival purpuse
  80.     set "folder=%%~nxa"
  81.  
  82.     REM strip folder name space
  83.     set "foldername=%%~nxa"
  84.  
  85.     set "foldername=!foldername: =!"
  86.    
  87.     REM set folder path
  88.     set folderpath=!root!\!folder!
  89.    
  90.     REM Course code
  91.     set "coursecode=!foldername:~0,6!"
  92.     echo Folder name stripted is: !foldername!
  93.  
  94.     REM Define course Language from folder
  95.     if "!foldername:~6,2!"=="ET" (
  96.         set "courselanguage=ET"
  97.        
  98.     ) else if "!foldername:~6,2!"=="EN" (
  99.         set "courselanguage=EN"
  100.        
  101.     ) else if "!foldername:~6,2!"=="RU" (
  102.         set "courselanguage=RU"
  103.        
  104.     ) else (
  105.         echo.
  106.     )
  107.    
  108.    
  109.     REM --IMAGE --
  110.     REM Set video top and bottom image variables
  111.  
  112.     REM Top image
  113.     if exist "%images%\!coursecode!_top.png" (
  114.         set "top_image=%images%\!coursecode!_top.png"
  115.     ) else (
  116.         set "top_image=%images%\Default_top.png"
  117.     )
  118.    
  119.     REM Bottom image
  120.     if exist "%images%\!coursecode!_bottom.png" (
  121.         set "bottom_image=%images%\!coursecode!_bottom.png"
  122.     ) else (
  123.         set "bottom_image=%images%\Default_bottom.png"
  124.     )
  125.  
  126.    
  127.     REM -- TRANSATIONS LIST & COUNT --
  128.     REM Define Translations list based on folder name
  129.    
  130.     REM Extract translations list
  131.     set foldersting=%%~nxa
  132.     for /f "tokens=2 delims=-" %%1 in ("!foldersting!") do (
  133.         set translations_list=%%1
  134.     )
  135.    
  136.     REM Count translations
  137.     set /A translations_count=0
  138.     for %%i in (!translations_list!) do (
  139.         set /A translations_count+=1       
  140.     )  
  141.  
  142.     REM ---------------------------------------------------
  143.     REM
  144.     REM   Sub-Folders processing start
  145.     REM
  146.     REM ---------------------------------------------------
  147.  
  148.     for /d %%b in ("%%a\*") do (
  149.         echo Processing subfolder %%b...
  150.    
  151.         set "subfoldername=%%~nxb"
  152.        
  153.         set subfolderpath=!root!\!folder!\!subfoldername!
  154.        
  155.         REM -----------------
  156.         REM log file creation
  157.         REM -----------------
  158.  
  159.         REM set filelist txt file name
  160.         set "logfile=!subfoldername! logfile.txt"
  161.    
  162.         if exist "!folderpath!\!logfile!" del "!folderpath!\!logfile!"
  163.        
  164.         echo _________________________________________________  >> "!folderpath!\!logfile!"
  165.         echo Processing start                                   >> "!folderpath!\!logfile!"
  166.         echo %date:/=-%_%time::=-%                              >> "!folderpath!\!logfile!"
  167.         echo _________________________________________________  >> "!folderpath!\!logfile!"
  168.         echo.                                                   >> "!folderpath!\!logfile!"
  169.         echo Files list:                                        >> "!folderpath!\!logfile!"
  170.         echo.                                                   >> "!folderpath!\!logfile!"
  171.  
  172.         REM ---------------------------------------------------
  173.         REM
  174.         REM   File processing start
  175.         REM
  176.         REM ---------------------------------------------------
  177.  
  178.         REM is this file ET, RU, EN set variables
  179.  
  180.         for %%c in ("%%b\*") do (
  181.             echo Processing file %%c...
  182.             set "filename=%%~nxc"
  183.        
  184.             REM Presentar  
  185.             if "!filename:_avo_=!" neq "!filename!" (
  186.                 set "presenter=%%~nxc"
  187.             )
  188.            
  189.             REM Presentation
  190.             if "!filename:_as_=!" neq "!filename!" (
  191.                 set "presentation=%%~nxc"
  192.             )
  193.            
  194.             REM NR 1 translation
  195.             if "!filename:_interpret_separate1=!" neq "!filename!" (
  196.                 set "translation_1=%%~nxc"
  197.             )
  198.            
  199.             REM NR 2 translation
  200.             if "!filename:_interpret_separate2=!" neq "!filename!" (
  201.                 set "translation_2=%%~nxc"
  202.             )
  203.            
  204.             REM NR 3 translation
  205.             if "!filename:_interpret_separate3=!" neq "!filename!" (
  206.                 set "translation_3=%%~nxc"
  207.             )
  208.            
  209.             REM Original audio
  210.             if "!filename:_Recording.m4a=!" neq "!filename!" (
  211.                 set "originalaudio=%%~nxc"
  212.                 echo Original audio is !originalaudio!
  213.             )
  214.      
  215.             REM Add the file name to the file list
  216.             echo %%~nxc         >> "!folderpath!\!logfile!"
  217.            
  218.         )
  219.         REM File processing ends
  220.        
  221.         REM ------------------------------------------------------------
  222.         REM
  223.         REM ENCONDIG Audio-video START
  224.         REM
  225.         REM -----------------------------------------------------------
  226.  
  227.         REM ---------------------------------------
  228.         REM When 0 TRANSLATIONS in Course title
  229.         REM ---------------------------------------
  230.  
  231.         if !translations_count!==0 (       
  232.        
  233.             set outputfile=!coursecode! !subfoldername! !courselanguage!.mp4
  234.            
  235.             REM Encode with  original audio
  236.             call :Func_EncodeFFmpeg "original"     
  237.             call :Func_LogFile "run"           
  238.             call :Func_MoveToEdit "run"
  239.            
  240.  
  241.         REM --------------------------------------
  242.         REM 1
  243.         REM When 1 TRANSLATIONS in Course title
  244.         REM --------------------------------------
  245.  
  246.         REM If zoom with 1 translation
  247.         ) else if !translations_count!==1 (            
  248.  
  249.                
  250.             set outputfile=!coursecode! !subfoldername! !courselanguage!.mp4
  251.            
  252.             REM Encode with  original audio
  253.             call :Func_EncodeFFmpeg "original"     
  254.             call :Func_LogFile "run"           
  255.             call :Func_MoveToEdit "run"            
  256.  
  257.             REM Loop translation list
  258.             REM ----------------------------------
  259.             for %%1 in (!translations_list!) do (
  260.                
  261.                 REM current translation audio
  262.                 set currenttranslation=%%1
  263.                 set translationaudio=!translation_1!
  264.                 REM Volume
  265.                 set originalavolume=volume=0.1
  266.                
  267.                 REM output filename
  268.                 set outputfile=!coursecode! !subfoldername! !currenttranslation!.mp4
  269.                
  270.                 REM Encode video with mixed original and translation audio
  271.                 call :Func_EncodeFFmpeg "translation"                      
  272.                 call :Func_LogFile "run"               
  273.                 call :Func_MoveToEdit "run"            
  274.             )
  275.             REM end for translation list
  276.        
  277.         REM Move files after encoding
  278.         REM call :Func_MoveToEdit "run"
  279.        
  280.        
  281.         REM ----------------------------------
  282.         REM 2
  283.         REM When REM en 2 TRANSLATIONS in Course title
  284.         REM ----------------------------------
  285.  
  286.         ) else if !translations_count!==2 (
  287.  
  288.             REM Loop translation list
  289.             REM -------------------------------------
  290.             for %%1 in (!translations_list!) do (
  291.                 set currenttranslation=%%1
  292.                
  293.                 REM IF course main language = tranlation langeuge
  294.                 REM ------------------------------------------------
  295.                 if "!currenttranslation!"=="!courselanguage!" (
  296.  
  297.                     REM With current situation, set translation file
  298.                     REM -----------------------------------------------
  299.                    
  300.                     REM set translation file, if course ET, translation ET
  301.                     if "!courselanguage!"=="ET" (
  302.                         set translationaudio=!translation_2!
  303.                        
  304.                     REM set translation file, if course RU, translation RU
  305.                     ) else if "!courselanguage!"=="RU" (
  306.                         set translationaudio=!translation_1!
  307.                        
  308.                     REM set translation file, if course EN, translation EN
  309.                     ) else if "!courselanguage!"=="EN" (
  310.                         set translationaudio=!translation_1!
  311.                        
  312.                     ) else (
  313.                         echo.                      
  314.                     )
  315.                    
  316.                     REM set ffmpgeg variables: original volume and outputfile
  317.                     set originalavolume=volume=1
  318.                     set outputfile=!coursecode! !subfoldername! !courselanguage!.mp4
  319.                    
  320.                     REM Call enconding, loging, moving functions
  321.                     call :Func_EncodeFFmpeg "translation"
  322.                     call :Func_LogFile "run"
  323.                     call :Func_MoveToEdit "run"
  324.                    
  325.                    
  326.                 REM IF course main language is not tranlation langeuge
  327.                 REM ---------------------------------------------------            
  328.                 ) else (
  329.                
  330.                     REM Course lang ET
  331.                     REM -----------------
  332.                     if "!courselanguage!"=="ET" (
  333.                    
  334.                         REM original audio only
  335.                         REM ------------------------
  336.                         set originalavolume=volume=1
  337.                         set outputfile=!coursecode! !subfoldername! !courselanguage!.mp4
  338.                        
  339.                         call :Func_EncodeFFmpeg "original"
  340.                         call :Func_LogFile "run"
  341.                         call :Func_MoveToEdit "run"
  342.                
  343.                    
  344.                         REM With current translation, set translation file
  345.                         REM -----------------------------------------------
  346.                         REM current translation is RU                      
  347.                         if "!currenttranslation!"=="RU" (                          
  348.                
  349.                             set translationaudio=!translation_2!
  350.                             set originalavolume=volume=0.1
  351.                             set outputfile=!coursecode! !subfoldername! !currenttranslation!.mp4
  352.                            
  353.                             call :Func_EncodeFFmpeg "translation"
  354.                             call :Func_LogFile "run"
  355.                             call :Func_MoveToEdit "run"
  356.  
  357.                            
  358.                         REM current translation is EN  
  359.                         ) else if "!currenttranslation!"=="EN" (                   
  360.                            
  361.                             set translationaudio=!translation_1!
  362.                             set originalavolume=volume=0.1
  363.                             set outputfile=!coursecode! !subfoldername! !currenttranslation!.mp4
  364.                            
  365.                             call :Func_EncodeFFmpeg "translation"
  366.                             call :Func_LogFile "run"
  367.                             call :Func_MoveToEdit "run"                        
  368.                            
  369.                         ) else (
  370.                             echo.
  371.                         )
  372.                     )
  373.                     REM end ET Courselanguage
  374.                    
  375.                    
  376.                     REM Course lang RU
  377.                     REM -----------------
  378.                     if "!courselanguage!"=="RU" (
  379.                    
  380.                         REM original audio only
  381.                         REM ------------------------
  382.                         set originalavolume=volume=1
  383.                         set outputfile=!coursecode! !subfoldername! !courselanguage!.mp4
  384.                        
  385.                         call :Func_EncodeFFmpeg "original"
  386.                         call :Func_LogFile "run"
  387.                         call :Func_MoveToEdit "run"
  388.                        
  389.                         if "!currenttranslation!"=="ET" (
  390.                            
  391.                             set translationaudio=!translation_2!
  392.                             set originalavolume=volume=0.1
  393.                             set outputfile=!coursecode! !subfoldername! !currenttranslation!.mp4
  394.                            
  395.                             call :Func_EncodeFFmpeg "translation"
  396.                             call :Func_LogFile "run"
  397.                             call :Func_MoveToEdit "run"
  398.  
  399.                            
  400.                         REM current translation is EN
  401.                         ) else if "!currenttranslation!"=="EN" (
  402.                        
  403.                             set translationaudio=!translation_1!                           
  404.                             set originalavolume=volume=0.1
  405.                             set outputfile=!coursecode! !subfoldername! !currenttranslation!.mp4
  406.                            
  407.                             call :Func_EncodeFFmpeg "translation"
  408.                             call :Func_LogFile "run"
  409.                             call :Func_MoveToEdit "run"
  410.                            
  411.                         ) else (
  412.                             echo.                          
  413.                         )
  414.                     )
  415.                     REM end RU
  416.  
  417.  
  418.                     REM IF Course lang EN
  419.                     REM -----------------
  420.                     if "!courselanguage!"=="EN" (
  421.                    
  422.                         REM original audio only
  423.                         REM ------------------------
  424.                         set originalavolume=volume=1
  425.                         set outputfile=!coursecode! !subfoldername! !courselanguage!.mp4
  426.                        
  427.                         call :Func_EncodeFFmpeg "original"
  428.                         call :Func_LogFile "run"
  429.                         call :Func_MoveToEdit "run"
  430.                        
  431.                         if "!currenttranslation!"=="ET" (
  432.                        
  433.                             set translationaudio=!translation_2!
  434.                             set originalavolume=volume=0.1
  435.                             set outputfile=!coursecode! !subfoldername! !currenttranslation!.mp4
  436.                            
  437.                             call :Func_EncodeFFmpeg "translation"
  438.                             call :Func_LogFile "run"
  439.                             call :Func_MoveToEdit "run"
  440.                            
  441.                         REM current translation RU
  442.                         ) else if "!currenttranslation!"=="RU" (
  443.                            
  444.                             set translationaudio=!translation_1!
  445.                             set originalavolume=volume=0.1
  446.                             set outputfile=!coursecode! !subfoldername! !currenttranslation!.mp4
  447.                            
  448.                             call :Func_EncodeFFmpeg "translation"                  
  449.                             call :Func_LogFile "run"
  450.                             call :Func_MoveToEdit "run"
  451.                            
  452.                         ) else (
  453.                             echo.
  454.                         )
  455.                     )
  456.                     REM end EN
  457.  
  458.                 )
  459.                 REM IF course main language is or is not tranlation language
  460.  
  461.             )
  462.             REM END: Translation list loop
  463.  
  464.         REM END: with translations_count = 2
  465.  
  466.  
  467.         REM -------------------------------------------
  468.         REM 3
  469.         REM When 3 TRANSLATIONS in Course title
  470.         REM -------------------------------------------
  471.         ) else if !translations_count! == 3 (
  472.        
  473.             echo arvan et translations count == 3
  474.            
  475.             REM Loop translation list
  476.             REM -------------------------------------
  477.             for %%1 in (!translations_list!) do (
  478.                 set currenttranslation=%%1
  479.                
  480.             REM With currenttranslation, set translation file
  481.             REM -----------------------------------------------
  482.                 if "!currenttranslation!"=="ET" (  
  483.                     set translationaudio=!translation_3!
  484.                
  485.                 ) else if "!currenttranslation!"=="RU" (
  486.                     set translationaudio=!translation_2!
  487.                
  488.                 ) else if "!currenttranslation!"=="EN" (
  489.                     set translationaudio=!translation_1!
  490.                
  491.                 ) else (
  492.                     echo.
  493.                 )
  494.  
  495.                 REM IF course main language = tranlation langeuge
  496.                 REM ------------------------------------------------
  497.                 if "!currenttranslation!"=="!courselanguage!" (
  498.                    
  499.                     set originalavolume=volume=1                   
  500.                     set outputfile=!coursecode! !subfoldername! !currenttranslation!.mp4
  501.                    
  502.                     REM Encode video viwth course lang=translation lang
  503.                    
  504.                     echo current translation = course language
  505.                     echo ennne encondigut
  506.                     REM siin veel ok
  507.                     pause
  508.                    
  509.                     call :Func_EncodeFFmpeg "translation"
  510.                    
  511.                     echo parast encodingut
  512.                     pause
  513.                     REM ---------------------------------------------------------------------
  514.                     REM Siin probleem !!!!!
  515.                     REM ---------------------------------------------------------------------
  516.                    
  517.                     echo enne logfile
  518.                     call :Func_LogFile "run"
  519.                     echo parast logfile
  520.                     pause
  521.                    
  522.                     echo enne moving FILES
  523.                     call :Func_MoveToEdit "run"
  524.                     echo parast moving files
  525.                     pause  
  526.  
  527.                    
  528.                 REM if translation is not course main language
  529.                 ) else (
  530.                
  531.                     REM set ffmpeg                 
  532.                     set originalavolume=volume=0.1                 
  533.                     set outputfile=!coursecode! !subfoldername! !currenttranslation!.mp4
  534.                    
  535.                     call :Func_EncodeFFmpeg "translation"
  536.                     call :Func_LogFile "run"
  537.                     call :Func_MoveToEdit "run"
  538.  
  539.                 )
  540.                 REM end current translation = course translation
  541.                
  542.             )
  543.             REM end translations list
  544.        
  545.         )
  546.         REM END: translations_count == 3
  547.  
  548.     )
  549.     REM subfolder end
  550.     REM echo subfolder end
  551.    
  552.  
  553. REM move foldes composed folder
  554. REM ------------------------------
  555. REM Call function for moving folders with argument "run"
  556.  
  557.  
  558. call :Func_MoveComposedFolders "run"
  559.  
  560. )
  561. REM folder end
  562.  
  563.  
  564.  
  565. REM ---------------------------------------------------------------
  566. REM
  567. REM    FUNCTION: Encode width ffmpeg
  568. REM  
  569. REM ---------------------------------------------------------------
  570.  
  571. :Func_EncodeFFmpeg
  572.  
  573. REM todo move file only if it exists
  574. REM todo not if exist but if not exists, then make folder
  575.    
  576.     REM IF argument in calling fuction is not empty then run this fuction
  577.     if not "%1"=="" (
  578.  
  579.         if "%~1"=="original" (
  580.  
  581.             REM Encode with originalaudio, side-by-side with top and bottom image
  582.             echo encode original
  583.             pause
  584.        
  585.             ffmpeg -i "!top_image!" -i "!subfolderpath!\!presentation!" -i "!subfolderpath!\!presenter!" -i "!bottom_image!" -i "!subfolderpath!\!originalaudio!" -filter_complex "[0:v]scale=1920:270[top]; [1:v]scale=960:540,setsar=1/1[pre]; [2:v]scale=960:540,setsar=1/1[prs]; [pre][prs]hstack=inputs=2[middle]; [3:v]scale=1920:270[bottom]; [top][middle][bottom]vstack=inputs=3[video]; [4:a]volume=1[audio]" -map "[video]" -map "[audio]" -c:v libx264 -preset medium -crf 23 -c:a aac -b:a 192k -ac 2 -ar 44100 -shortest -y "!folderpath!\!outputfile!"
  586.            
  587.        
  588.         ) else if "%~1"=="translation" (
  589.    
  590.             REM Encode with originalaudio and translationaudio, side-by-side with top and bottom image 
  591.             echo encode translation
  592.             pause
  593.        
  594.             ffmpeg -i "!top_image!" -i "!subfolderpath!\!presentation!" -i "!subfolderpath!\!presenter!" -i "!bottom_image!" -i "!subfolderpath!\!originalaudio!" -i "!subfolderpath!\!translationaudio!" -filter_complex "[0:v]scale=1920:270[top]; [1:v]scale=960:540,setsar=1/1[pre]; [2:v]scale=960:540,setsar=1/1[prs]; [pre][prs]hstack=inputs=2[middle]; [3:v]scale=1920:270[bottom]; [top][middle][bottom]vstack=inputs=3[video]; [4:a]!originalavolume![a1]; [5:a]volume=1[a2]; [a1][a2]amix=inputs=2[audio]" -map "[video]" -map "[audio]" -c:v libx264 -preset medium -crf 23 -c:a aac -b:a 192k -ac 2 -ar 44100 -shortest -y "!folderpath!\!outputfile!"
  595.            
  596.         ) else (
  597.  
  598.             echo !!! seems that  Fucntion "EncodeFFmpeg" argument not working
  599.             pause
  600.  
  601.         )
  602.  
  603.     )
  604.    
  605. goto :eof
  606.  
  607. REM ------------------------------------------------------------
  608.  
  609.  
  610.  
  611.  
  612.  
  613. REM ---------------------------------------------------------------
  614. REM
  615. REM    FUNCTION: Log file
  616. REM  
  617. REM ---------------------------------------------------------------
  618.  
  619. :Func_LogFile
  620.  
  621. REM todo move file only if it exists
  622. REM todo not if exist but if not exists, then make folder
  623.    
  624.     REM IF argument in calling fuction is not empty then run this fuction
  625.     if not "%1"=="" (
  626.    
  627.         echo -------------------------------                                >> "!folderpath!\!logfile!"
  628.         echo.                                                               >> "!folderpath!\!logfile!"
  629.         echo encoded time: %date:/=-%_%time::=-%                            >> "!folderpath!\!logfile!"
  630.         echo encoded file: !coursecode! !subfoldername! !currenttranslation! >> "!folderpath!\!logfile!"
  631.         echo.                                                               >> "!folderpath!\!logfile!"
  632.  
  633.     )
  634.    
  635. goto :eof
  636.  
  637. REM ------------------------------------------------------------
  638.  
  639.  
  640.  
  641. REM ---------------------------------------------------------------
  642. REM
  643. REM    FUNCTION: Arhvice (move) composed file
  644. REM  
  645. REM ---------------------------------------------------------------
  646. :Func_MoveToEdit
  647.  
  648. REM todo move file only if it exists
  649. REM todo not if exist but if not exists, then make folder
  650.    
  651.     REM IF argument in calling fuction is not empty then run this fuction
  652.     if not "%1"=="" (
  653.          
  654.         REM If the target folder dones not exists, create this folder
  655.         if not exist "!editfolder!\!coursecode!" (
  656.             mkdir "!editfolder!\!coursecode!"
  657.         )
  658.        
  659.         REM  move composed file from the source folder to the target folder
  660.         REM robocopy C:\source C:\target File /mov
  661.         robocopy "!root!/!folder!" "!editfolder!\!coursecode!" "!outputfile!" /mov
  662.     )
  663.    
  664. goto :eof
  665. REM ------------------------------------------------------------
  666.  
  667.  
  668.  
  669.  
  670. REM ---------------------------------------------------------------
  671. REM
  672. REM    FUNCTION: Arhvice (move) composed folders with result files
  673. REM  
  674. REM ---------------------------------------------------------------
  675. :Func_MoveComposedFolders
  676.    
  677.     REM IF argument in calling fuction is not empty then run this fuction
  678.     if not "%1"=="" (
  679.          
  680.         REM Check if the target folder already exists
  681.         if exist "!composed!\!folder!" (
  682.        
  683.             REM  If it exists, move all files from the source folder to the target folder
  684.             robocopy "!root!/!folder!" "!composed!\!folder!" /move /e /np /s
  685.        
  686.         ) else (
  687.             REM If it doesn't exist, move the entire subfolder to the target folder
  688.             move "!root!/!folder!" "!composed!"
  689.            
  690.         )
  691.        
  692.     )
  693. goto :eof
  694. REM ------------------------------------------------------------
  695.  
  696.  
  697.  
  698.  
  699. REM  END Local
  700. endlocal
Advertisement
Add Comment
Please, Sign In to add comment