Hi, all.
I'm working with a content spec that wants me to name every piece of content to %fileName%_%versionNumber%.MOV where %versionNumber% is a 3 digit number starting at 001.
So the versions of a certain file in a folder would be: myFile_001.MOV, myFile_002.MOV, etc.
Is there a way so that if I drop myFile.MOV into the watch folder, to make the output follow that spec, both for the first one being named _001 and any subsequent time being _002, etc?
I've tried playing with Output Prefix and Unique Name in Deliveries: Folder, but I can't figure out a way to make it work with the naming spec.
Thanks!
Suffix on unique name
Re: Suffix on unique name
Aye Tirnion,
welcome to the Forum and thank you for using FFAStrans! Happy to have you with us
OK this is a little bit tricky as we don't have any iterating functions in ffastrans, so we need to do the iteration in a script outside of ffastrans.
I wrote a little .bat for that. It is a little confusing how to use it, let me know any question.
So, our bat file shall calculate the next free number, e.g. we want to get something like 005 from it. For this, we must pass the "base" output filename to the batch, e.g. \\server\share\OUTFolder\BASEFILENAME.ext
Where the basefilename shall be the original filename without any numbering.
Example:
c:\temp\increment.bat \\server\share\file.ext
In this case, the batch would return _001 if \\server\share\file_001.ext does not exist.
In the following example workflow, all you need to do is to alter the first Populate proc and define your output folder and extension. Then submit some file and the output should be named 001.ext. Submit the same input filename again and output will be 002.ext
Let me know any question.
Content of c:\temp\increment.bat
welcome to the Forum and thank you for using FFAStrans! Happy to have you with us
OK this is a little bit tricky as we don't have any iterating functions in ffastrans, so we need to do the iteration in a script outside of ffastrans.
I wrote a little .bat for that. It is a little confusing how to use it, let me know any question.
So, our bat file shall calculate the next free number, e.g. we want to get something like 005 from it. For this, we must pass the "base" output filename to the batch, e.g. \\server\share\OUTFolder\BASEFILENAME.ext
Where the basefilename shall be the original filename without any numbering.
Example:
c:\temp\increment.bat \\server\share\file.ext
In this case, the batch would return _001 if \\server\share\file_001.ext does not exist.
In the following example workflow, all you need to do is to alter the first Populate proc and define your output folder and extension. Then submit some file and the output should be named 001.ext. Submit the same input filename again and output will be 002.ext
Let me know any question.
Content of c:\temp\increment.bat
Code: Select all
@echo off
REM takes a filename as parameter, checks if filename_001.ext exists and outputs the next available number e.g. 002
set BASEFILENAME=%~dpn1_
set EXT=%~x1
set count=50000
setlocal EnableDelayedExpansion
for /L %%i in (1, 1, %count%) do (
set "formattedValue=000000%%i"
if exist "%BASEFILENAME%!formattedValue:~-3!%EXT%" (
REM FILE EXISTS; TRY NEXT COUNTER
) else (
REM File DOES NOT EXIST, THIS WILL BE THE NEXT OUTPUT FILE
GOTO EXIT
)
)
:EXIT
ECHO _!formattedValue:~-3!
emcodem, wrapping since 2009 you got the rhyme?