Deliver to the *first folder* after watchfolder

Questions and answers on how to get the most out of FFAStrans
artjuice
Posts: 38
Joined: Mon Mar 20, 2023 11:33 pm

Deliver to the *first folder* after watchfolder

Post by artjuice »

Hi

Need help and advice - how to deliver files to the first folder after watchfolder in wich they stored.
Or make variable %_original_path+n% - Folder name n-step forward begin from UNC-path.
What i mean:

1. Monitor->Folder:
\\server_1\share\%i_year%-%i_mon%-%i_mday%\CARD_1\PRIVATE\XDROOT\Clip - Clip0001....Clip00nn.mxf
\\server_1\share\%i_year%-%i_mon%-%i_mday%\CARD_2\PRIVATE\Clip - Clip0001....Clip00nn.mxf
\\server_1\share\%i_year%-%i_mon%-%i_mday%\CARD_3\Clip - Clip0001....Clip00nn.mxf

2. Encode to mp4

3. Deliver->Folder:
\\server_2\share\%i_year%-%i_mon%-%i_mday%\CARD_1 - Clip0001....Clip00nn.mp4
\\server_2\share\%i_year%-%i_mon%-%i_mday%\CARD_2 - Clip0001....Clip00nn.mp4
\\server_2\share\%i_year%-%i_mon%-%i_mday%\CARD_3 - Clip0001....Clip00nn.mp4
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Deliver to the *first folder* after watchfolder

Post by emcodem »

Hi artjuice,

welcome to the forum and thank you for using FFAStrans!

Very good question and not too easy to solve. The all time favourite "regex" is your friend :D The following examples assume that you create a new user_variable and assign a value to it in populate variables processor.

This for example works if you always have at least 2 subfolders e.g. %watchfolder%\CARD1\Clips:
%s_my_toplevel_path% = $regext("%s_recursed_path%","\\(.*?)\\")

This example is a little bit more complex but it adds support for only 1 subfolder and multiple subfolders in one shot e.g. %watchfolder%\Clips OR %watchfolder%\CARD1\Clips:
%s_my_toplevel_path% = $regext("%s_recursed_path%","\\(.*?)\\|\\(.*?)$")

Then you set delivery processor prefix to "%s_my_toplevel_path% - "

Going on, you can skip one folder by prepending \\.*?\\, e.g. get the second subfolder after %watchfolder%
%s_my_toplevel_path% = $regext("%s_recursed_path%","\\.*?\\(.*?)\\")


Unfortunately this will only work with watchfolders and not using manual submit or API because s_recursed_path only has an actual value when the job has been started by watchfolder processor. What i do to speed up testing is in workflow properties, set sleep timer to 5.

Sidequestion: you really got clips in "private"? What kind of obscure misuse of the xdcam disc is this? :D
emcodem, wrapping since 2009 you got the rhyme?
artjuice
Posts: 38
Joined: Mon Mar 20, 2023 11:33 pm

Re: Deliver to the *first folder* after watchfolder

Post by artjuice »

Wow!)

@emcodem big thx! I will try it.

from my folder structure example, i think it the right choice:
emcodem wrote: Tue Mar 21, 2023 7:46 am Going on, you can skip one folder by prepending \\.*?\\, e.g. get the second subfolder after %watchfolder%
%s_my_toplevel_path% = $regext("%s_recursed_path%","\\.*?\\(.*?)\\")
emcodem wrote: Tue Mar 21, 2023 7:46 am Sidequestion: you really got clips in "private"? What kind of obscure misuse of the xdcam disc is this? :D
Hah, its just for an example that subfolders can be with different structure and depth :)
Last edited by artjuice on Tue Mar 21, 2023 9:13 pm, edited 1 time in total.
artjuice
Posts: 38
Joined: Mon Mar 20, 2023 11:33 pm

Re: Deliver to the *first folder* after watchfolder

Post by artjuice »

Nope, it doesn't work for me.

Maybe I'm doing something wrong...
The result I get is:
all encoded video from CARD_1, 2, 3 goes to one folder \\server_2\share\%i_year%-%i_mon%-%i_mday%\0


Yep, it was my mistace, i thast somehow set varuable type as integer.

This work fine, thx:
emcodem wrote: Tue Mar 21, 2023 7:46 am This example is a little bit more complex but it adds support for only 1 subfolder and multiple subfolders in one shot e.g. %watchfolder%\Clips OR %watchfolder%\CARD1\Clips:
%s_my_toplevel_path% = $regext("%s_recursed_path%","\\(.*?)\\|\\(.*?)$")
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Deliver to the *first folder* after watchfolder

Post by emcodem »

Glad you got it working, have fun working with FFAStrans :D
emcodem, wrapping since 2009 you got the rhyme?
artjuice
Posts: 38
Joined: Mon Mar 20, 2023 11:33 pm

Re: Deliver to the *first folder* after watchfolder

Post by artjuice »

Also, i have one more thing - need to do some protection in case of mistace copy, can you help?)

if files (Clip0001....Clip00nn) in a root of %watchfolder% deliver them to a specified folder "OTHERS":

%watchfolder%\ files Clip0001....Clip00nn
%watchfolder%\ CARD_1\PRIVATE\XDROOT\Clip - Clip0001....Clip00nn.mxf
%watchfolder%\ CARD_2\PRIVATE\Clip - Clip0001....Clip00nn.mxf
%watchfolder%\ CARD_3\Clip - Clip0001....Clip00nn.mxf

%deliverfolder%\ OTHERS\Clip0001....Clip00nn
%deliverfolder%\ CARD_1\Clip0001....Clip00nn.mxf
%deliverfolder%\ CARD_2\Clip0001....Clip00nn.mxf
%deliverfolder%\ CARD_3\Clip0001....Clip00nn.mxf
artjuice
Posts: 38
Joined: Mon Mar 20, 2023 11:33 pm

Re: Deliver to the *first folder* after watchfolder

Post by artjuice »

Oh i can thast make monitor only root %watchfolder% deliver all to subfolder "OTHERS" and than one more monitor all subfolders ^_^

Nope, bad idie. I cant modifay %watchfolder% :(
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Deliver to the *first folder* after watchfolder

Post by emcodem »

Sorry didnt understand why you would need to modify %watchfolder% for your 2 monitor approach.
Anyway, you could also use a conditional processor to check if %s_recursed_path% IS NOT (empty)... In that case, you connect 2 outputs on the conditional proc, one executes on success, the other one on error (right-click little green input box on the processor, set "on error")
emcodem, wrapping since 2009 you got the rhyme?
artjuice
Posts: 38
Joined: Mon Mar 20, 2023 11:33 pm

Re: Deliver to the *first folder* after watchfolder

Post by artjuice »

emcodem wrote: Tue Mar 21, 2023 11:45 pm Sorry didnt understand why you would need to modify %watchfolder% for your 2 monitor approach.
Sorry, i mean i cant move, modify files & folders(only read permission) in folder that need to monitor :lol:
artjuice
Posts: 38
Joined: Mon Mar 20, 2023 11:33 pm

Re: Deliver to the *first folder* after watchfolder

Post by artjuice »

emcodem wrote: Tue Mar 21, 2023 11:45 pm Sorry didnt understand why you would need to modify %watchfolder% for your 2 monitor approach.
Anyway, you could also use a conditional processor to check if %s_recursed_path% IS NOT (empty)... In that case, you connect 2 outputs on the conditional proc, one executes on success, the other one on error (right-click little green input box on the processor, set "on error")
I cant breack this *wall*, dont understend how correctly process separatly files from watchfolder root to OTHERS and subfolders as is in my example(CARD_1,2,3, etc).

My WF:
input CARDS to MP4.json
(9.45 KiB) Downloaded 213 times
Post Reply