VideoHelp Forum




+ Reply to Thread
Results 1 to 18 of 18
  1. Hi cats,

    thanks to ndjamena I use this script to transcode any mxf files, but now I would like use the base script to rename a list of .mxf files

    I have a list of mxf that are numerated as this example:

    C0001.MXF
    C0002.MXF
    C0003.MXF
    C0004.MXF
    etc...

    Click image for larger version

Name:	mxflist.jpg
Views:	954
Size:	311.6 KB
ID:	34712

    the date of C0001.MXF (24.08.2015 13:57:53) is lower of the date of C0002.MXF (13:58:04)
    the date of C0002.MXF (24.08.2015 13:58:04) is lower of the date of C0003.MXF (13:58:14)
    etc...

    My target is rename all .mxf starting from a number that I input to the batch when he ask me it:
    for example I need to rename all .mxf starting from C0501

    the batch have to rename all .mxf so that

    C0001.MXF -----> renamed to C0501.MXF
    C0002.MXF -----> renamed to C0502.MXF
    C0003.MXF -----> renamed to C0503.MXF
    etc...

    OR another example: in the num inputted is 655 the batch have to:

    C0001.MXF -----> renamed to C0655.MXF
    C0002.MXF -----> renamed to C0656.MXF
    C0003.MXF -----> renamed to C0657.MXF
    etc...

    I have this batch but it don't work well:

    Code:
    @rem unless otherwise specified for debugging reasons turn echo off
    @if "%EMode%"=="" Set EMode=ON
    @ECHO %EMode%
    @ECHO off  
    
    cls
    
    SetLocal DisableDelayedExpansion
    
    Set "EXTLIST=*.MXF"
    Set "DoPop=0"
    Set "ARGLVL=0"
    Set "FileName-DQ="
    Set VD_LOC="v:\automazioneclip\VirtualDub\vdub.exe"
    
    set "DestFolder=."
    Set "WorkFolder=%DestFolder%"
    
    rem process the arguments one by one
    
    
    set /p "num= INSERT START NUMERATION: "
    
    :ARGS
    color
    	
    	rem if there are no further arguments then exit the batch.
    	if [%1]==[] (
    		if "%ARGLVL%"=="0" (
    			CALL :GetTargetName		
    			EndLocal
    			pause
    		)
    		goto :eof
    	)
    
    	rem wildcard processing
    	Set "FileName=%~1"
    	if "%FileName%"=="" (
    		SHIFT
    		goto :ARGS
    	)
    
    	rem if the argument doesn't exist in the file system in any form skip it.
    	if NOT EXIST %1 (
    		SHIFT
    		goto :ARGS
    	)
    
    	if NOT [%1]==[] if NOT "%FileName:^*=%%FileName:^?=%"=="%FileName%%FileName%" (
    		for %%w in (%1) DO (
    			Set /a ARGLVL+=1
    			CALL :ARGS "%%~fw"
    			Set /a ARGLVL-=1
    		)
    		SHIFT
    		goto :ARGS
    	)
    	Set "FileName="
    		
    	rem Set search/recursion variables
    	Set "Pattern=%EXTLIST%"
    	Set "STARTLVL=0"
    	Set "FOUNDLVL=1024"
    	
    	rem if the argument is the current directory then process everything in it.
    	if "%~f1"=="%CD%" (
    		rem echo Processing Directory "%CD%"
    		CALL :START %1
    		SHIFT
    		goto :ARGS
    	)
    	rem Test if the argument is a directory, if it is move to it then process everything in it, if not then move to the file's parent directory and process the file.  Then return to starting directory.
    	Type NUL
    	pushd "%~f1" 2> nul
    	if NOT "%errorlevel%"=="0" (
    		if NOT "%CD%\"=="%~dp1" (
    			pushd "%~dp1"
    			Set "DoPop=1"
    		)
    		Set Pattern="%~nx1"
    	) else (
    		rem echo Processing Directory "%~f1"
    		Set "DoPop=1"
    	)
    	CALL :START %1
    	if "%DoPop%"=="1" (
    		popd
    		Set "DoPop=0"
    	)
    	SHIFT
    
    goto :ARGS
    
    :START <CURRENT_ARG>
    color
    	rem Count is superseded by FOUNDLVL but may still be useful for renaming purposes
    	Set "Count=0"
    	rem Process all files in the current directory fitting the arguments search pattern.
    	for /F "delims=" %%y in ('dir %Pattern% /b /o:-d /t:w') do (
    		if /I NOT "%%~y"=="File Not Found" CALL :Process_File "%%~fy"
    	)
    	rem if it didn't find anything search all directories instead
    goto :eof
    	if "%Count%"=="0" if %STARTLVL% LSS %FOUNDLVL% (
    		for /d %%b in (*) do (
    			pushd "%%~fb"
    			rem echo Processing Directory "%%~fb"
    			Set /a STARTLVL+=1
    			CALL :START "%%~fb"
    			Set /a STARTLVL-=1
    			popd
    		)
    	)
    
    goto :eof
    
    :Process_File <FILENAME>
    color
    
            rem *** check if file is MXF
            Set "TokenS=0"
            Set "isMXF=0"
            IF "%~x1"==".MXF" Set "TokenS=1" 
            IF "%~x1"==".mxf" Set "TokenS=1"
            If "%TokenS%"=="1" Set "isMXF=1"
    
    if "%isMXF%"=="1" (CALL :MXFrenaming "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
    
    	echo  DONE
    	echo.
    	echo ---------------------------------------------
    	echo.
    	EndLocal
    	
    goto :eof
    
    
    :MXFrenaming <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME>
    
    echo *** MXF renaming routine ***
    
    echo processing "%~dp1%~n1.MXF"
    
    for /L %%a in (%num%,1,999) do (
       if not exist "%~dp1C0%%a.mxf" (ren "%~dp1%~n1.MXF" "C0%%a.MXF"
    if exist "%~dp1C0%%a.mxf" set "FilenameForCameraOnline=%~dp1C0%%a.mxf">"%~n1"_renamed_in_"C0%%a_MXF".log)
    )
    
           
     goto :eof
    
    :GetTargetName
    color
    
    	Set "FileName="
    	Set /p FileName=InputFileName 
    	
    	rem Add or remove double-quotes if necessary
    
    	if NOT DEFINED FileName (
    		Set "FileName-DQ="
    		goto :DQSkip
    	)
    	
    	Set "FileName-DQ=%FileName:"=%"
    	if NOT DEFINED FileName-DQ (
    		Set "FileName="
    		Set "FileName-DQ="
    		goto :DQSkip
    	)
    	
    	if EXIST "%FileName-DQ%" (
    		if "%FileName-DQ%"=="%FileName-DQ: =%" (
    			Set "FileName=%FileName-DQ%"
    		) else (
    			Set FileName="%FileName-DQ%"
    		)
    	)
    :DQSkip
    color
    
    	if /I "%FileName-DQ%"=="" Set FileName="%CD%"
    	if /I "%FileName-DQ%"=="CD" Set FileName="%CD%"
    	if /I "%FileName-DQ%"=="EXIT" goto :eof
    	if /I "%FileName-DQ%"=="NOEXIT" goto :GetTargetName
    	if DEFINED FileName (
    		Set /a ARGLVL+=1
    		CALL :ARGS %FileName%
    		Set /a ARGLVL-=1
    	)
    	
    goto :GetTargetName
    For example I apply the batch to the first 8 mxf file in my folder (I have drag and drop the first 8 files into the batch icon, C0001.MXF C0002.MXF C0003.MXF C0004.MXF C0005.MXF C0006.MXF C0007.MXF C0008.MXF) starting numeration (%num%) from 501, but it produces this bad result:

    Click image for larger version

Name:	RENAMERR.jpg
Views:	1146
Size:	236.9 KB
ID:	34713

    the problem is that the renaming is not in sequence with the date of the older file present in the folder.

    I would like to modify the batch so that:

    C0001.MXF -----> have to renamed in C0501.MXF (and not C0504.MXF, because C0001.MXF is the older file present in the folder)
    C0002.MXF -----> have to renamed in C0502.MXF (and not C0505.MXF, because C0002.MXF is the older file present in the folder, after renaming C0001.MXF)
    C0003.MXF -----> have to renamed in C0503.MXF (and not C0506.MXF, because C0003.MXF is the older file present in the folder, after renaming C0001.MXF and C0002.MXF)

    it it possible this?

    THANKS
    Last edited by marcorocchini; 5th Dec 2015 at 05:49.
    Quote Quote  
  2. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    *sigh*

    So basically, you highlighted 1 to 8 then you clicked on 6 and dragged IT onto the batch. And of course the batch did 6 first, no?

    Try clicking on 1 instead and dragging IT onto the batch.
    Quote Quote  
  3. yes I have highlighted 1 to 8 and dragged the selection onto the batch

    Click image for larger version

Name:	RENERR1.jpg
Views:	816
Size:	301.3 KB
ID:	34716

    using 501 as starting sequence

    but results is wrong:

    Click image for larger version

Name:	RENERR2.jpg
Views:	833
Size:	240.1 KB
ID:	34715

    I don't well understand what means "Try clicking on 1 instead and dragging IT onto the batch": if I drag&drop the C0001.MXF the batch change only C0001.MXF in C0501.MXF

    is there another way?
    Image Attached Thumbnails Click image for larger version

Name:	RENAMERR.jpg
Views:	287
Size:	236.9 KB
ID:	34714  

    Quote Quote  
  4. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    SELECT 1 TO 8, and THEN DRAG ONE onto the batch, NOT SIX.
    Quote Quote  
  5. mm ok but when I select a group of files during drag operation appear all files select to drag

    Click image for larger version

Name:	ERR4.jpg
Views:	875
Size:	210.8 KB
ID:	34719
    Quote Quote  
  6. The file names are sent starting with the particular file you drag. So if you highlight 13 to 21, but drag 17 to the batch file the order the batch file receives the names is 17, 18, 19, 20, 21, 13, 14, 15, 16.
    Quote Quote  
  7. Oh my ...

    Click image for larger version

Name:	really.jpg
Views:	836
Size:	24.2 KB
ID:	34720
    Quote Quote  
  8. --------------------------------------- thanks thanks
    Quote Quote  
  9. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Interestingly enough, Windows 10 doesn't do that. However, if I write a batch to rename the contents of an entire directory it starts from the first file, renames every single file in the directory and then processes the first file again, leaving me with a numbering that starts at 2 and sorts the first file last. Add to that, if I have a file with a path name that contains a comma and no spaces and try to drag THAT onto a batch, the path will be split into two arguments at the comma and the batch won't be able to process the file at all.
    Quote Quote  
  10. as a side note: I use Flex Renamer (http://hp.vector.co.jp/authors/VA014830/english/FlexRena/) for such tasks,...
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  11. oh in effect the script, as is, don't work well.

    I have try using this list of 25 mxf:

    Click image for larger version

Name:	MXFL1.jpg
Views:	898
Size:	144.3 KB
ID:	34723

    and try to rename %num% using 061, so that, it shoul produce

    C0001.MXF -----> C0061.MXF
    C0002.MXF -----> C0062.MXF
    C0003.MXF -----> C0063.MXF
    etc..

    but not
    this is the result:

    Click image for larger version

Name:	RENERR3.jpg
Views:	785
Size:	308.4 KB
ID:	34724

    it start from 049
    Quote Quote  
  12. mmmmmmmmmm I need of a cat solution

    Click image for larger version

Name:	RATCAT.jpg
Views:	817
Size:	223.9 KB
ID:	34729
    Quote Quote  
  13. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Even cats aren't so stubborn as to ignore other, better options: Use one of the many good batch file renamers (Flex Renamer, as mentioned above, A Better File Renamer, Bulk Rename Utility, 1-for-A File Renamer,...). It's like you're going out of your way to make it more difficult. Same with the other thread (virtual drive issue, which I gave an elegant solution for - SUBST - and you ignored).
    "You can lead a cat to milk, but you can't make him drink."

    Scott
    Quote Quote  
  14. mmmm I have try whit this script:

    Code:
    @rem unless otherwise specified for debugging reasons turn echo off
    @if "%EMode%"=="" Set EMode=ON
    @ECHO %EMode%
    @ECHO off  
    
    cls
    
    SetLocal DisableDelayedExpansion
    
    Set "EXTLIST=*.MXF"
    Set "DoPop=0"
    Set "ARGLVL=0"
    Set "FileName-DQ="
    Set VD_LOC="v:\automazioneclip\VirtualDub\vdub.exe"
    
    set "DestFolder=."
    Set "WorkFolder=%DestFolder%"
    
    rem process the arguments one by one
    
    cls 
    
    
    set /p "num= INSERT START NUMERATION: "
    
    
    echo num uguale a %num%
    set /a num2=%num%
    echo num2 uguale a %num2%
    
    
    :ARGS
    color
    	
    	rem if there are no further arguments then exit the batch.
    	if [%1]==[] (
    		if "%ARGLVL%"=="0" (
    			CALL :GetTargetName		
    			EndLocal
    			pause
    		)
    		goto :eof
    	)
    
    	rem wildcard processing
    	Set "FileName=%~1"
    	if "%FileName%"=="" (
    		SHIFT
    		goto :ARGS
    	)
    
    	rem if the argument doesn't exist in the file system in any form skip it.
    	if NOT EXIST %1 (
    		SHIFT
    		goto :ARGS
    	)
    
    	if NOT [%1]==[] if NOT "%FileName:^*=%%FileName:^?=%"=="%FileName%%FileName%" (
    		for %%w in (%1) DO (
    			Set /a ARGLVL+=1
    			CALL :ARGS "%%~fw"
    			Set /a ARGLVL-=1
    		)
    		SHIFT
    		goto :ARGS
    	)
    	Set "FileName="
    		
    	rem Set search/recursion variables
    	Set "Pattern=%EXTLIST%"
    	Set "STARTLVL=0"
    	Set "FOUNDLVL=1024"
    	
    	rem if the argument is the current directory then process everything in it.
    	if "%~f1"=="%CD%" (
    		rem echo Processing Directory "%CD%"
    		CALL :START %1
    		SHIFT
    		goto :ARGS
    	)
    	rem Test if the argument is a directory, if it is move to it then process everything in it, if not then move to the file's parent directory and process the file.  Then return to starting directory.
    	Type NUL
    	pushd "%~f1" 2> nul
    	if NOT "%errorlevel%"=="0" (
    		if NOT "%CD%\"=="%~dp1" (
    			pushd "%~dp1"
    			Set "DoPop=1"
    		)
    		Set Pattern="%~nx1"
    	) else (
    		rem echo Processing Directory "%~f1"
    		Set "DoPop=1"
    	)
    	CALL :START %1
    	if "%DoPop%"=="1" (
    		popd
    		Set "DoPop=0"
    	)
    	SHIFT
    
    goto :ARGS
    
    :START <CURRENT_ARG>
    color
    	rem Count is superseded by FOUNDLVL but may still be useful for renaming purposes
    	Set "Count=0"
    	rem Process all files in the current directory fitting the arguments search pattern.
    	for /F "delims=" %%y in ('dir %Pattern% /b /o:-d /t:w') do (
    		if /I NOT "%%~y"=="File Not Found" CALL :Process_File "%%~fy"
    	)
    	rem if it didn't find anything search all directories instead
    goto :eof
    	if "%Count%"=="0" if %STARTLVL% LSS %FOUNDLVL% (
    		for /d %%b in (*) do (
    			pushd "%%~fb"
    			rem echo Processing Directory "%%~fb"
    			Set /a STARTLVL+=1
    			CALL :START "%%~fb"
    			Set /a STARTLVL-=1
    			popd
    		)
    	)
    
    goto :eof
    
    :Process_File <FILENAME>
    color
    
            rem *** check if file is MXF
            Set "TokenS=0"
            Set "isMXF=0"
            IF "%~x1"==".MXF" Set "TokenS=1" 
            IF "%~x1"==".mxf" Set "TokenS=1"
            If "%TokenS%"=="1" Set "isMXF=1"
    
    if "%isMXF%"=="1" (CALL :MXFrenaming "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
    
    	echo  DONE
    	echo.
    	echo ---------------------------------------------
    	echo.
    	EndLocal
    	
    goto :eof
    
    
    :MXFrenaming <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME>
    
    echo *** MXF renaming routine ***
    echo processing "%~dp1%~n1.MXF"
    
    echo percorso del myfiletxt uguale a "%~dp1%myfiles.txt"
    
    if exist myfiles.txt del myfiles.txt
    
    dir *.mxf /a-d /b >myfiles.txt
    
    md "%~dp1tempbatchprocess"
    
    for /f "tokens=* delims= " %%a in (myfiles.txt) do type nul >"%~dp1tempbatchprocess\%%~na.cam"
    
    for /L %%a in (%num2%,1,999) do (
       if not exist "%~dp1tempbatchprocess\C0%%a.cam" if not exist "%~dp1C0%%a.mxf" (ren "%~dp1%~n1.MXF" "C0%%a.MXF"
    if exist "%~dp1C0%%a.mxf" set "FilenameForCameraOnline=%~dp1C0%%a.mxf">"%~n1"_renamed_in_"C0%%a_MXF".log)
    )
        
       )
           
           if exist "%~dp1tempbatchprocess" RD /S /q "%~dp1tempbatchprocess"
           if exist myfiles.txt del myfiles.txt
    
    
     cls
          
     goto :eof
    
    :GetTargetName
    color
    
    	Set "FileName="
    	Set /p FileName=InputFileName 
    	
    	rem Add or remove double-quotes if necessary
    
    	if NOT DEFINED FileName (
    		Set "FileName-DQ="
    		goto :DQSkip
    	)
    	
    	Set "FileName-DQ=%FileName:"=%"
    	if NOT DEFINED FileName-DQ (
    		Set "FileName="
    		Set "FileName-DQ="
    		goto :DQSkip
    	)
    	
    	if EXIST "%FileName-DQ%" (
    		if "%FileName-DQ%"=="%FileName-DQ: =%" (
    			Set "FileName=%FileName-DQ%"
    		) else (
    			Set FileName="%FileName-DQ%"
    		)
    	)
    :DQSkip
    color
    
    	if /I "%FileName-DQ%"=="" Set FileName="%CD%"
    	if /I "%FileName-DQ%"=="CD" Set FileName="%CD%"
    	if /I "%FileName-DQ%"=="EXIT" goto :eof
    	if /I "%FileName-DQ%"=="NOEXIT" goto :GetTargetName
    	if DEFINED FileName (
    		Set /a ARGLVL+=1
    		CALL :ARGS %FileName%
    		Set /a ARGLVL-=1
    	)
    	
    goto :GetTargetName
    and the problem in half-solved

    but there are 2 particular case:

    case 1) if the number of start is between 10 and 99
    case 2) if the number of start is between 0 and 9
    Quote Quote  
  15. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    mmmmmmmmmmmmmmmm you don't listen.
    Quote Quote  
  16. for example I would like rename this first 10 files selected, starting from C0104

    Image
    [Attachment 34730 - Click to enlarge]


    the new batch produce this correct result:

    Image
    [Attachment 34731 - Click to enlarge]


    but if the start is a number between 10 and 99 - for example 85 - the result is:

    Image
    [Attachment 34732 - Click to enlarge]


    or f the start is a number between 0 and 9 - for example 5 - the result is:

    Image
    [Attachment 34733 - Click to enlarge]


    So I need add little enhancement to the batch so that:

    if the lenght of the final renamed file is of 3 characters ----> add 2 zero after the "C" so that the final result is C0005.MXF

    if the lenght of the final renamed file is of 4 characters ----> add 1 zero after the "C" so that the final result is C0085.MXF
    Quote Quote  
  17. Originally Posted by Cornucopia View Post
    mmmmmmmmmmmmmmmm you don't listen.
    How have to do? I'm a cat
    Quote Quote  
  18. Code:
    @rem unless otherwise specified for debugging reasons turn echo off
    @if "%EMode%"=="" Set EMode=ON
    @ECHO %EMode%
    @ECHO off  
    
    cls
    
    SetLocal DisableDelayedExpansion
    
    Set "EXTLIST=*.MXF"
    Set "DoPop=0"
    Set "ARGLVL=0"
    Set "FileName-DQ="
    Set VD_LOC="v:\automazioneclip\VirtualDub\vdub.exe"
    
    set "DestFolder=."
    Set "WorkFolder=%DestFolder%"
    
    rem process the arguments one by one
    
    cls 
         
    set /p "num= INSERT start enumeration:  "
    
    
    
    echo num uguale a %num%
    set /a num2=%num%/1
    echo num2 uguale a %num2%
    
    
    :ARGS
    color
    	
    	rem if there are no further arguments then exit the batch.
    	if [%1]==[] (
    		if "%ARGLVL%"=="0" (
    			CALL :GetTargetName		
    			EndLocal
    			pause
    		)
    		goto :eof
    	)
    
    	rem wildcard processing
    	Set "FileName=%~1"
    	if "%FileName%"=="" (
    		SHIFT
    		goto :ARGS
    	)
    
    	rem if the argument doesn't exist in the file system in any form skip it.
    	if NOT EXIST %1 (
    		SHIFT
    		goto :ARGS
    	)
    
    	if NOT [%1]==[] if NOT "%FileName:^*=%%FileName:^?=%"=="%FileName%%FileName%" (
    		for %%w in (%1) DO (
    			Set /a ARGLVL+=1
    			CALL :ARGS "%%~fw"
    			Set /a ARGLVL-=1
    		)
    		SHIFT
    		goto :ARGS
    	)
    	Set "FileName="
    		
    	rem Set search/recursion variables
    	Set "Pattern=%EXTLIST%"
    	Set "STARTLVL=0"
    	Set "FOUNDLVL=1024"
    	
    	rem if the argument is the current directory then process everything in it.
    	if "%~f1"=="%CD%" (
    		rem echo Processing Directory "%CD%"
    		CALL :START %1
    		SHIFT
    		goto :ARGS
    	)
    	rem Test if the argument is a directory, if it is move to it then process everything in it, if not then move to the file's parent directory and process the file.  Then return to starting directory.
    	Type NUL
    	pushd "%~f1" 2> nul
    	if NOT "%errorlevel%"=="0" (
    		if NOT "%CD%\"=="%~dp1" (
    			pushd "%~dp1"
    			Set "DoPop=1"
    		)
    		Set Pattern="%~nx1"
    	) else (
    		rem echo Processing Directory "%~f1"
    		Set "DoPop=1"
    	)
    	CALL :START %1
    	if "%DoPop%"=="1" (
    		popd
    		Set "DoPop=0"
    	)
    	SHIFT
    
    goto :ARGS
    
    :START <CURRENT_ARG>
    color
    	rem Count is superseded by FOUNDLVL but may still be useful for renaming purposes
    	Set "Count=0"
    	rem Process all files in the current directory fitting the arguments search pattern.
    	for /F "delims=" %%y in ('dir %Pattern% /b /o:-d /t:w') do (
    		if /I NOT "%%~y"=="File Not Found" CALL :Process_File "%%~fy"
    	)
    	rem if it didn't find anything search all directories instead
    goto :eof
    	if "%Count%"=="0" if %STARTLVL% LSS %FOUNDLVL% (
    		for /d %%b in (*) do (
    			pushd "%%~fb"
    			rem echo Processing Directory "%%~fb"
    			Set /a STARTLVL+=1
    			CALL :START "%%~fb"
    			Set /a STARTLVL-=1
    			popd
    		)
    	)
    
    goto :eof
    
    :Process_File <FILENAME>
    color
    
            rem *** check if file is MXF
            Set "TokenS=0"
            Set "isMXF=0"
            IF "%~x1"==".MXF" Set "TokenS=1" 
            IF "%~x1"==".mxf" Set "TokenS=1"
            If "%TokenS%"=="1" Set "isMXF=1"
    
    if "%isMXF%"=="1" (CALL :MXFrenaming "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1")
    
    	echo  DONE
    	echo.
    	echo ---------------------------------------------
    	echo.
    	EndLocal
    	
    goto :eof
    
    
    :MXFrenaming <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME>
    
    echo *** MXF renaming routine ***
    echo processing "%~dp1%~n1.MXF"
    
    echo percorso del myfiletxt uguale a "%~dp1%myfiles.txt"
    
    if exist myfiles.txt del myfiles.txt
    
    dir *.mxf /a-d /b >myfiles.txt
    
    md "%~dp1tempbatchprocess"
    
    for /f "tokens=* delims= " %%a in (myfiles.txt) do type nul >"%~dp1tempbatchprocess\%%~na.cam"
    
    for /L %%a in (%num%,1,999) do (
       if not exist "%~dp1tempbatchprocess\C0%%a.cam" if not exist "%~dp1C0%%a.mxf" if not exist "%~dp1C00%%a.mxf" if not exist "%~dp1C000%%a.mxf" (ren "%~dp1%~n1.MXF" "C0%%a.MXF"
    if exist "%~dp1C0%%a.mxf" set "FilenameForCameraOnline=C0%%a">"%~n1"_renamed_in_"C0%%a.MXF".log)
    )
        
       )
    
    set file=%FilenameForCameraOnline%.MXF
    for %%f in (%file%) do set "filename=%%~nf"
    echo old file: %filename%
    
    if "%filename:~2,1%"=="" goto skip
    if "%filename:~4,1%"=="" goto renfile
    goto skip
    
    :renfile
    if "%filename:~3,1%"=="" goto renfile3
    set "newfile=%file:~0,1%0%file:~1%"
    ren %file% %newfile%
    ren "%~n1_renamed_in_%FilenameForCameraOnline%.mxf.log" "%~n1_renamed_in_%newfile%.log"
    
    goto done
    
    :renfile3
    set "newfile=%file:~0,1%00%file:~1%"
    ren %file% %newfile%
    
    ren "%~n1_renamed_in_%FilenameForCameraOnline%.mxf.log" "%~n1_renamed_in_%newfile%.log"
    
    goto done
    
    :skip
    :done
           
           if exist "%~dp1tempbatchprocess" RD /S /q "%~dp1tempbatchprocess"
           if exist myfiles.txt del myfiles.txt
    
    
     cls
          
     goto :eof
    
    :GetTargetName
    color
    
    	Set "FileName="
    	Set /p FileName=InputFileName 
    	
    	rem Add or remove double-quotes if necessary
    
    	if NOT DEFINED FileName (
    		Set "FileName-DQ="
    		goto :DQSkip
    	)
    	
    	Set "FileName-DQ=%FileName:"=%"
    	if NOT DEFINED FileName-DQ (
    		Set "FileName="
    		Set "FileName-DQ="
    		goto :DQSkip
    	)
    	
    	if EXIST "%FileName-DQ%" (
    		if "%FileName-DQ%"=="%FileName-DQ: =%" (
    			Set "FileName=%FileName-DQ%"
    		) else (
    			Set FileName="%FileName-DQ%"
    		)
    	)
    :DQSkip
    color
    
    	if /I "%FileName-DQ%"=="" Set FileName="%CD%"
    	if /I "%FileName-DQ%"=="CD" Set FileName="%CD%"
    	if /I "%FileName-DQ%"=="EXIT" goto :eof
    	if /I "%FileName-DQ%"=="NOEXIT" goto :GetTargetName
    	if DEFINED FileName (
    		Set /a ARGLVL+=1
    		CALL :ARGS %FileName%
    		Set /a ARGLVL-=1
    	)
    	
    goto :GetTargetName
    Last edited by marcorocchini; 6th Dec 2015 at 04:05.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!