How do you hold a file until the rest copy?

Post Reply
MarkStrecker
Newbie
Posts: 7
Joined: Wed Apr 26, 2017 2:27 pm

How do you hold a file until the rest copy?

Post by MarkStrecker »

I am new to Switch and can't write JavaScript code (at least not yet). I have a flow that copies PDF files for digital printing from one network server to another. One the receiving server, which is at another print plant, the files copy into a folder that is monitored by a Switch system independent from the one I am using (meaning that I can't do anything with the receiving Switch flow, just the one I made to move the files from one server to another). Along with the PDFs, we send a text file that has a name matching the folder in which the PDFs are sent. The receiving Switch flow will start processing the these PDFs when the receiving Switch receives the text file (which moves into a different folder on the receiving server). If, for example, the job folder were named "1234567891011_T", the text file would be named that as well. The number of PDFs in a given folder vary from job to job, and the folder names are almost always unique.

Here is the problem. I don't want the text file to copy to the receiving server until after the PDFs have completely copied. Is there a way to do this? I tried setting up a Hold folder that will release the text file when it sees a job folder of the same name on the receiving server, but this didn't work. It released the moment Switch created the folder on the receiving server, but before the files had copied. I tried to do something simpler like setting up the hold folder to release the text file after an hour, but when there are lot of files at once, it might take up to four hours to copy, and I don't want a four hour delay during times when it takes far less for a given job to move to the receiving server.

Any advice would be much appreciated. Thanks!
Screenshot 2.jpg
Screenshot 2.jpg (58.23 KiB) Viewed 7976 times
loicaigon
Advanced member
Posts: 378
Joined: Wed Jul 10, 2013 10:22 am

Re: How do you hold a file until the rest copy?

Post by loicaigon »

Hi,

I wonder if ftp couldn't be the key here. I mean FTP receive element should watch for loading completeness before it tries to retrieve the file. So if a file is available after 10mns or after 4hours, it should be downloaded right away.
If you ever choose compress job element, you may as well uncompress job and get not only the job itself but all the associated metadata such as hierarchy.
Only issue is that you double the transfert time, as you need to both upload and download the file. Plus you need a FTP server.

FWIW

Loic
MarkStrecker
Newbie
Posts: 7
Joined: Wed Apr 26, 2017 2:27 pm

Re: How do you hold a file until the rest copy?

Post by MarkStrecker »

Thanks for you input! It is much appreciated to say the least. Alas, the server in question is not an FTP nor am I likely to convince anyone to make it one.
freddyp
Advanced member
Posts: 1022
Joined: Thu Feb 09, 2012 3:53 pm

Re: How do you hold a file until the rest copy?

Post by freddyp »

Set the "Folder constraint" property of the outgoing connection of "Hold job" to "Yes" and I am sure you will find what you need.
MarkStrecker
Newbie
Posts: 7
Joined: Wed Apr 26, 2017 2:27 pm

Re: How do you hold a file until the rest copy?

Post by MarkStrecker »

Thanks for the suggestion. Alas, this does not work, either. The trouble is, each incoming job is different. It has a unique name and the number of files for a given job varies. So does the file size. What I want to do is a bit of Boolean logic that releases the text file after the job has completely copied to the target folder. I can make it release upon seeing a folder name that matches the text file's name, but it does so too soon: the moment it sees the folder it releases rather than waiting for the entire job to finish copying. Is there any kind of Java code that will tell it to release the text file only when the it matches the folder name and all the files in that folder have completed there move?
jslater
Member
Posts: 23
Joined: Fri Oct 14, 2011 7:35 pm

Re: How do you hold a file until the rest copy?

Post by jslater »

Not sure if/how you would make this work, since you said you're not using FTP, but hopefully it gives you some ideas. This flow would copy all the print files to one location, and the text file to a user-managed folder (wherever you want it to be). Once the FTP is complete, it outputs a log file that is then used to inject the text file back into the flow. Here's a screenshot:
Screen Shot 2017-05-08 at 8.08.15 AM.png
Screen Shot 2017-05-08 at 8.08.15 AM.png (73.53 KiB) Viewed 7954 times
Post Reply