renaming only, sorry (not xcopy)
Hi ****,
please can I ask you a very very difficult thing?
I have a file called mycat.avi inside a folder VIDEO
so that the path is c:\video\mycat.avi
now I would like rename it so that the new re-name become start from C0700.mxf
IF in folder c:\video is jet present another C0700.mxf -----> the file have to renamed C0701.mxf
if in folder c:\video is jet present another C0701.mxf -----> the file have to renamed C0702.mxf
if in folder c:\video is jet present another C0702.mxf -----> the file have to renamed C0703.mxf
... and so on
Supposing mycat.avi become renamed as C0716.mxf (so that now is present as c:\video\C0716.mxf)
--> after the renaming operation, the batch have to create a .avs file (located alwais in the c:\video folder) that are called mycat_is_C0716.avs that contains:
FFVideoSource("c:\video\C0716.mxf")
So finally, in c:\video
are present only C0716.mxf and mycat_is_C0716.avs
THANKS![]()
+ Reply to Thread
Results 1 to 8 of 8
-
Last edited by marcorocchini; 2nd Oct 2014 at 07:32.
-
cats, cats, cats
Over-complication personified.
You create TWO folders. One you could call c:\video and one you could call c:\video\final
Move all the completed files to .....\final
Just have the working file in ...\video
Once that is finished, manually rename it to something different to those in .....\final
Move that completed file to .....\final
voila !!!!!!
purr, purr, purr -
So, is the .avs file just a renamed .mxf or is there a conversion being done somewhere in there? If you just want to rename the file then use the REN command:
Code:REN c:\video\%%1.mxf c:\video\mycat_is_%%1.avs
If you want to keep both files just use COPY, the principle is the same. But, if you have to convert the .mxf into a .avs, then you should be able to specify the name of the output file.
Edit: I meant .avi -> .mxf, is there some processing going on or what?Last edited by nic2k4; 2nd Oct 2014 at 10:30. Reason: Confused.
-
ah sorry, cancel I'm wrong:
we make the case that an avi file c:\video\mycat.avi is present and that it should - instead be renamed - xcopied with extension .mxf
so .avi and .mxf is video file
YES: I need batch automate and drag and drop, I use the kindly base-script of ndjamena to do this
for example:
Code:@rem unless otherwise specified for debugging reasons turn echo off @if "%EMode%"=="" Set EMode=ON @ECHO %EMode% @ECHO off SetLocal DisableDelayedExpansion Set "EXTLIST=*.*" 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 :ARGS 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> 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 /od /a-d') 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> cls Set /a Count+=1 Set "FOUNDLVL=%STARTLVL%" SetLocal DisableDelayedExpansion if exist "%~dpn1.wav" ( set "Audio=%~dpn1.wav" ) else ( set "Audio=v:\automazioneclip\system\empty.wav") rem Find TimeCode Info Set AUCount=0; CALL :Make_File_generic "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1" echo FATTO echo. echo --------------------------------------------- echo. EndLocal goto :eof :Make_File_generic <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME> echo generic routine xcopy c:\video\mycat.avi ... .... .... ... bla bla bla goto :eof :GetTargetName 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 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
-
I should have asked this first, but you have the crappiest thread titles and I went off on a tangent. Why C0700, why not the date and time? What would trigger the rename and AVS file generation?
This is a very simple solution, as such it's very inefficient:
Code:@ECHO OFF SET fold$=c:\video SET file$=mycat.avi SET mxf$= FOR /L %%F IN (0,1,999) DO ( IF EXIST %fold$%\%file$% IF NOT EXIST %fold$%\C0%%F.mxf REN %fold$%\%file$% %fold$%\C0%%F.mxf && SET mxf$=C0%%F ) ECHO FFVideoSource("%fold$%\%mxf$%.mxf") > %fold$%\mycat_is_%mxf$%.avs :end
Last edited by nic2k4; 2nd Oct 2014 at 12:07. Reason: Oops
-
I'm a cat
have some problem?
hoewver thank you for your support
I would like do a batch that do this:
you have your source for example a .mp4 file, or a .avi or a video file ec..
Drag and drop your file into the icon of the desktop and the batch ask you: want you HD or SD? (where is meant 1920x1080@50i and SD is 720x576@50i) and you made your choise
the batch automatically generate a .mpj project-file and play it on Mainconcept Totalcode, that contains source path and the name of the destination file that have to be transcoded and save a .mxf file named with the progressive naming for example C0700.mxf C0701.mxf ecc.. in the same dir of the source.
The .mpj jet contains all info for transcoding process (codec, audio track, video track ecc..)
This naming system is for put the final .mxf back to the camcorder (sony xdcam series) that accept only this form: C0001.MXF .. C0002.MXF ecc...
trigger and avs is meant to identify, better in a directory, the source and his correspondent .mxf
for example:
mycat.mp4 -----mxf transcoding-----> C0700.mxf
and mycat_is_C0700.AVS indicate to you that C0700.mxf contain the transcoded mycat.mp4
The .avs contain also the FFVideoSource("c:\video\mycat.mp4") to recall the source in TotalcodeLast edited by marcorocchini; 2nd Oct 2014 at 13:45.
-
Code:
@rem unless otherwise specified for debugging reasons turn echo off @if "%EMode%"=="" Set EMode=ON @ECHO %EMode% @ECHO off SetLocal DisableDelayedExpansion Set "EXTLIST=*.*" 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 :ARGS 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> 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 /od /a-d') 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> Set /a Count+=1 Set "FOUNDLVL=%STARTLVL%" SetLocal DisableDelayedExpansion if exist "%~dpn1.wav" ( set "Audio=%~dpn1.wav" ) else ( set "Audio=v:\automazioneclip\system\empty.wav") rem Find TimeCode Info Set AUCount=0; for /f "tokens=1,2 delims=^=" %%g in ('v:\automazioneclip\virtualdubmod\FFProbe -hide_banner -loglevel fatal -pretty -show_streams -show_entries stream^=codec_type^,width^,height^,sample_aspect_ratio:stream_disposition^=:format_tags^=timecode^,company_name^,product_name^,product_version "%~1" 2^>^&1') DO ( if "%%~g"=="TAG:company_name" set "T_Company_Name=%%~h" if "%%~g"=="TAG:product_name" set "T_Product_Name=%%~h" if "%%~g"=="TAG:product_version" set "T_Product_Version=%%~h" if "%%~g"=="TAG:timecode" set "TIMECODE=%%~h" if "%%~g"=="width" set "V_Width=%%~h" if "%%~g"=="height" set "V_Height=%%~h" if "%%~g"=="sample_aspect_ratio" set "V_PAR=%%~h" if "%%~g"=="codec_type" if "%%~h"=="audio" set /a AUCount+=1 ) if "%V_Width%"=="" ( echo ERROR: Video Width NOT FOUND! pause goto :eof ) if "%V_Height%"=="" ( echo ERROR: Video Height NOT FOUND! pause goto :eof ) if "%V_PAR%"=="" ( echo ERROR: Video PAR NOT FOUND! pause goto :eof ) ) rem Set "V_Q=UD" rem if %V_Width% LEQ 1920 if %V_Height% LEQ 1120 \\ Set "V_Q=HD" rem if %V_Width% LEQ 1280 if %V_Height% LEQ 752 Set "V_Q=MD" if %V_Width% LEQ 1024 if %V_Height% LEQ 608 Set "V_Q=SD" echo Using %V_Q% Mode echo PAR = %V_PAR% if "%TimeCode%"=="" echo Warning! no TimeCode Found! if NOT "%TimeCode%"=="" echo Timecode= %TIMECODE% echo %~f1>realINPUTfilename.txt echo %~dp1%~n1TotalcodeHDout.mxf>realOUTPUTfilename.txt v:\automazioneclip\system\gsar.exe -s\ -r/ "%~dp1/realINPUTfilename.txt" -f "%~dp1/newinputfilename.txt" v:\automazioneclip\system\gsar.exe -s\ -r/ "%~dp1/realOUTPUTfilename.txt" -f "%~dp1/newOUTPUTfilename.txt" set /p INPUTfilenamefortotalcode=<newINPUTfilename.txt set /p OUTPUTfilenamefortotalcode=<newOUTPUTfilename.txt echo new INPUT filename for totalcode is %INPUTfilenamefortotalcode% echo new OUTPUT filename for totalcode is %OUTPUTfilenamefortotalcode% CALL :Make_File_generic "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1" echo FATTO echo. echo --------------------------------------------- echo. EndLocal goto :eof :Make_File_generic <txt_FILENAME> <txt_FILENAME> <FILENAME> <ORG_FILENAME> echo processing source file %4 copy /y "v:\automazioneclip\core\HD.mpj" "%~dp1%~n1.mpj" v:\automazioneclip\system\fart.exe "%~dp1%~n1.mpj" W:/inputdirectory/inputfilename.MXF "%INPUTfilenamefortotalcode%" v:\automazioneclip\system\fart.exe "%~dp1%~n1.mpj" V:/uscitaTotalcode/fileoutputtedfromtotalcode.mxf "%OUTPUTfilenamefortotalcode%" goto :eof :GetTargetName 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 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