|
Answer» Hi,, I need to fix this problem now.
I am making a batch script. It is about that if users drag and drop the first image file in a folder, the script should read what the last file name is and it will get ONE sequence file name.
For example, there is a folder with images like "test.0002.jpg", "test.0002.jpg", "test.0002.jpg", "test.0003.jpg", "test.0004.jpg", "test.0005.jpg", "test.0006.jpg", "test.0007.jpg". If I drag the first image, "test.0002.jpg", and I drop it into .bat, it should automatically change like "test.0002-0007.jpg".
When I test my script, it can read first image, but it can't read whole images.
My script is =========================================================== :convertMOVIE IF %1 == "" GOTO end "C:\Program Files (x86)\djv 0.8.2\bin\djv_convert.exe" %1 "%~d1%~p1%~n1.MOV" SHIFT GOTO convertMOVIE :end ECHO. ECHO Done! pause ============================================================
"div_convert.exe" is a free software to convert image sequece to quicktime format. The basic command is like "div_convert.exe test.001-005.jpg test.mov"
Please help me...
Thank you.1. Is the numerical sequence, 0002, 0007, etc, always 4 digits, 2. Is it always at the end of the name part of the filename? 3. Do you mean you want to change just the first filename of the sequence?
Quote it can read first image, but it can't read whole images.
I am not sure what you mean by this. Hi.. Thank you for the response.
1. numerical sequence number is different. sometimes 5 digits, sometimes 3 digits
2. test.0002.jpg, test.0003.jpg, test.0004.jpg, test.0005.jpg....
3. ex, there are 5 files, like image.0004.jpg, image.0005.jpg, image.0006.jpg, image.0007.jpg, image.0008.jpg i want to convert these to movie. The converter should reand these sequence files to "image.0004-0008.jpg" Then it executes as "div_convert.exe image.0004-0008.jpg test.mov" It will make a movie.
Quote from: ylthh on October 16, 2010, 01:19:21 PMHi,, I need to fix this problem now.
I am making a batch script. It is about that if users drag and drop the first image file in a folder, the script should read what the last file name is and it will get one sequence file name.
For example, there is a folder with images like "test.0002.jpg", "test.0003.jpg", "test.0004.jpg", "test.0005.jpg", "test.0006.jpg", "test.0007.jpg". If I drag the first image, "test.0002.jpg", and I drop it into .bat, it should automatically change like "test.0002-0007.jpg".
When I test my script, it can read first image, but it can't read whole images.
My script is =========================================================== :convertMOVIE IF %1 == "" GOTO end "C:\Program Files (x86)\djv 0.8.2\bin\djv_convert.exe" %1 "%~d1%~p1%~n1.mov" SHIFT GOTO convertMOVIE :end ECHO. ECHO Done! pause ============================================================
"div_convert.exe" is a free software to convert image sequece to quicktime format. The basic command is like "div_convert.exe test.001-005.jpg test.mov"
Please help me...
Thank you.
So you just rename the first file?
Why have you QUOTED yourself?
correct, rename the first file.is filename format always something dot NNNN dot jpg like this: abcd.0001.jpg? (always three parts separated by dots?)
yes
Code: [Select]echo off set fullname=%~1 set foldernm=%~dp1 set barename=%~nx1 cd /d "%foldernm%" for /f "tokens=1-3 delims=." %%A in ("%barename%") do ( set fileroot=%%A set firstnum=%%B set fileextn=%%C ) set filespec=%fileroot%.*.%fileextn% for /f "tokens=1-3 delims=." %%A in ('dir /b "%filespec%"') do set lastnum=%%B set param1=%fileroot%.%firstnum%-%lastnum%.%fileextn% set param2=%fileroot%.mov "C:\Program Files (x86)\djv 0.8.2\bin\djv_convert.exe" "%param1%" "%param2%" pause
Hi, Salmon
Thank you so much for your help.
In network server, "dir /b" didn't work well. The file order is not alphabetical. Then I added dir /b /o, then it worked. Is it correct? Then when I execute batch file, it worked.
Thank you so much again.
Quote from: ylthh on October 17, 2010, 09:02:10 AMIn network server, "dir /b" didn't work well. The file order is not alphabetical. Then I added dir /b /o, then it worked. Is it correct?
That sounds good to me.
|