Compress all files in folder when newest file is older than 30 min

Post Reply
User avatar
magnussandstrom
Advanced member
Posts: 345
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden
Contact:

Compress all files in folder when newest file is older than 30 min

Post by magnussandstrom »

My case: A customer will batch-send hundreds of PDF-files to a folder on our server, every batch of files is one job (a new batch of files will arrive a few times a week). We dont know the exact number of files in every batch, but they will not send multiple batches on the same day.

When new files arrives I want Switch to wait until the last file is transferred to us, and than I want to compress all files in the folder to one zip-file for further processing, and delete the original files.

Since I don't know how many files we are receiving or what time of day the files will arrive I was thinking that I some how can make Switch check when there is new files in the folder and wait 30 minutes after the last change before making the zip file.

Any suggestions how I can create this behaviour in my Switch flow?
Last edited by magnussandstrom on Thu Apr 15, 2021 9:09 am, edited 1 time in total.
jan_suhr
Advanced member
Posts: 586
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Compress all files in folder when newest file is older than 30 min

Post by jan_suhr »

Inject Job with "Time of day" as the trigger, could that work for you?
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
User avatar
magnussandstrom
Advanced member
Posts: 345
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden
Contact:

Re: Compress all files in folder when newest file is older than 30 min

Post by magnussandstrom »

Inject job "Time of day" might cause us to lose production time. Lets say the batch of files arrives at 7 in the morning and the trigger is set to 12 mid day, we lose 5 hours of valuble production time. Or even worse the trigger is set to 12 mid day and the batch of files starts to arrive 11:59 but all files are not present until 12:02, I will only get half of the files in the ZIP-file. Inject job a specific time of day is not a good solution in this case I think..
patej
Member
Posts: 79
Joined: Sun Nov 25, 2012 12:15 pm

Re: Compress all files in folder when newest file is older than 30 min

Post by patej »

Would it work to just have an Assemble job before Archive? Set it to assemble by "arbitrary files", "every 10000 jobs" (or anything else too big) with the orphan timeout as 30 minutes ––> files are assembled as a job folder after 30 minutes has passed since the last file.
User avatar
magnussandstrom
Advanced member
Posts: 345
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden
Contact:

Re: Compress all files in folder when newest file is older than 30 min

Post by magnussandstrom »

patej wrote: Thu Apr 15, 2021 9:48 am Would it work to just have an Assemble job before Archive? Set it to assemble by "arbitrary files", "every 10000 jobs" (or anything else too big) with the orphan timeout as 30 minutes ––> files are assembled as a job folder after 30 minutes has passed since the last file.
YES! I was trying 'Assemble job' yesterday but I didn't figure out that I could use the 'Orphan timeout' like that. Thank you!
Post Reply