Watch Folder_Wait for File Copy to complete

Questions and answers on how to get the most out of FFAStrans
erik
Posts: 2
Joined: Mon Jun 22, 2020 1:10 pm

Watch Folder_Wait for File Copy to complete

Post by erik »

Hi!

I have a workflow in which a Watch Folder will pick up any video file and pass it on to the encoder. These video files already exist on my drive and will be copied to the watch folder if transcoding is desired.

Some video files are pretty large and take time to fully copy to the watch folder. It seems that Windows calculates and reserves the file size up front. The file size is not growing, like when you're exporting a video file from Adobe Premiere or Avid Mediacomposer, but the final file size is displayed immediately. This results in FFAStrans picking up the file too early and a failed job.

Is there a way to wait for a completed file copy before picking up the file? Maybe a setting I don't know about or a Command Line solution?

Thanks in advance!

Erik
momocampo
Posts: 594
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: Watch Folder_Wait for File Copy to complete

Post by momocampo »

Hello Erik and welcome to the forum,
I think the option that you're looking for is "check growing file", inside Monitor folder node. Choose "once".
Hope it helps ;)

Cheers.

Benjamin
Ghtais
Posts: 164
Joined: Thu Jan 19, 2017 11:06 am

Re: Watch Folder_Wait for File Copy to complete

Post by Ghtais »

Hi Erik

this is a strange problem, I'am using many workflow like that (copy file in a watch folder for encoding) and I have no issue even with big file (more than 50 Go)
As momocampo said, check growing file and once :)

bye
erik
Posts: 2
Joined: Mon Jun 22, 2020 1:10 pm

Re: Watch Folder_Wait for File Copy to complete

Post by erik »

Hi everyone,

Thanks for your responses!

Unfortunately that doesn't work here. As you can see in my screenshot, I checked "check growing files" and selected "once".
These were already my settings so the problem still occurs.

Is there a command line solution which will check if a copy is completed?

Thanks again!

Erik
Attachments
ScreenShot.jpg
ScreenShot.jpg (127.88 KiB) Viewed 10624 times
momocampo
Posts: 594
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: Watch Folder_Wait for File Copy to complete

Post by momocampo »

Hello Erik,

Weird, because this is the good option in theory.
Anyway, you can to adjust your "sleep timer" (workflow properties and general) and set to several minutes for example.
Tell us if it can help.
;)
Benjamin
emcodem
Posts: 1749
Joined: Wed Sep 19, 2018 8:11 am

Re: Watch Folder_Wait for File Copy to complete

Post by emcodem »

Hey erik,

your probelm is strange, it should actually work without problems.
As it does not work, the workaround might not work as well, but if you want to do it with batch, then try something like that:

Code: Select all

@echo off
:filenotready
echo Checking file readiness
ping 127.0.0.1 -n 4 > nul
if not exist %1 GOTO end
copy /b %1 +,,
echo %errorlevel%
if /i "%errorlevel%" NEQ "0" GOTO :filenotready
:end
Save this to a batch file e.g. c:\temp\test.bat and in your cmd executor do something like that:

Code: Select all

cmd /C ""c:\temp\test.bat" "%s_source%""
emcodem, wrapping since 2009 you got the rhyme?
dklooker
Posts: 29
Joined: Mon May 22, 2017 1:22 pm

Re: Watch Folder_Wait for File Copy to complete

Post by dklooker »

Hi,

This is quite a late reply, but we did some additional testing. And when we copy a file to a watchfolder on a server on the computer where ffastrans is running the growing file option is working. But when we do this on a different workstation where ffastrans is not running then the problem occurs that a file is picked up while still being copied and then it fails.

We are not yet on the latest version. But is this as designed or do I need to chenge something in my configuration?
emcodem
Posts: 1749
Joined: Wed Sep 19, 2018 8:11 am

Re: Watch Folder_Wait for File Copy to complete

Post by emcodem »

Hey @dklooker

the checks before a job is being started are:
1) if you enabled check growing, the filesize will be considered and a job will only start if the size did not change for at least 2 iterations (time according to your wf setting sleep time)
2) independent of your settings, it checks if the file can be opened for reading before a job is started

If you copy files into the watchfolder using windows copy, the "check growing" will actually not be of use because windows copy reserves the full space for the file from the start of copy, so the size will never change. But windows copy will lock the currently written file so it cannot be opened for reading.

In your case, obviously, we are able to read from the file while it is being copied. So, IF you use windows explorer copy, there must be something about the storage that you are using that allows to open the file while it is being copied.

Did you try the batch that i posted here? There is a chance that it works for you because the batch tries to open the file for writing instead of reading which might be the solution to your issue.

If you let us know that the batch works for you, we might want to internally discuss an option for "write check" option in the monitor instead of "read check only".
emcodem, wrapping since 2009 you got the rhyme?
dklooker
Posts: 29
Joined: Mon May 22, 2017 1:22 pm

Re: Watch Folder_Wait for File Copy to complete

Post by dklooker »

Great! I am checking it out. And the batch command is starting. However after file copy is done I still get the error access is denied from the log. I also checked if s_source has the right variable, and that is the case.

I will check on a different network drive if the results are the same.

I attached a printscreen of the batch file. This is on a different network drive but with the same error.
Attachments
Readyness.png
Readyness.png (324.95 KiB) Viewed 7729 times
emcodem
Posts: 1749
Joined: Wed Sep 19, 2018 8:11 am

Re: Watch Folder_Wait for File Copy to complete

Post by emcodem »

OK that looks good. The batch should run and give this message until the file is ready. As soon as the file is ready, the batch will end.

If that works, you can easily hook the batch into your workflow and it will wait at this point until the stuff is finished.
emcodem, wrapping since 2009 you got the rhyme?
Post Reply