Page 1 of 1

Command Executor cannot append file

Posted: Fri Jun 21, 2019 5:18 pm
by dlebrero
I'm trying to create a workflow that will read certain metadata form files and dump the information on a txt file.
Here is the command I use:
"%comspec%" /c ""C:\MediaInfo-cli\MediaInfo.exe" "--Output=file://C:\MediaInfo-cli\template_mediainfo.txt" "%source%" >> "Z:\Mediainfo_All_Files.txt""

The issue I'm having is that since the SW is multi threading and runs in parallel in different computers some instances will try to append to the destination file, but since another instance is writing to it it fails, so I got the info of some files and no others.

Is there a way to wait for the file to be unlocked to write to it?

If you or someone else has a working solution can you share?

Re: Command Executor cannot append file

Posted: Fri Jun 21, 2019 5:24 pm
by dlebrero
btw, here is the template I'm using to get only the info I want:

General;%CompleteName% | %FileSize/String3% | %Duration/String%
Video; |Video: %Width%x%Height% | %DisplayAspectRatio/String% | %FrameRate%\n

Re: Command Executor cannot append file

Posted: Mon Jun 24, 2019 7:21 am
by emcodem
Hi,
i don't know a direct way to wait for the file lock but you can reduce the time your text file is opened/locked from multiple minutes (currently your text file is locked while mediainfo is running) to a few milliseconds by setting the output of your mediainfo cmd to a variable first:

in a batch file:

Code: Select all

FOR /F "tokens=* USEBACKQ" %%F IN (`dir /s c:`) DO (ECHO %%F>> c:\temp\out.txt)
direct usage without batch file:

Code: Select all

FOR /F "tokens=* USEBACKQ" %F IN (`dir /s c:`) DO (ECHO %F>> c:\temp\out.txt)
(replace dir /s c:\ by your mediafino cmd)

cheers!
emcodem