Command Executor cannot append file

Here you can submit bugreports
Post Reply
dlebrero
Posts: 15
Joined: Thu Apr 06, 2017 3:01 pm

Command Executor cannot append file

Post 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?
dlebrero
Posts: 15
Joined: Thu Apr 06, 2017 3:01 pm

Re: Command Executor cannot append file

Post 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
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Command Executor cannot append file

Post 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
emcodem, wrapping since 2009 you got the rhyme?
Post Reply