I have a job folder come in with sereval files in it. They are PDFs containing texts and covers. I need to find out the number of pages in any one of the text files and rename the folder or route the whole folder to an appropriate output connection. I can do most of it, and I know the number of pages is available in the job properties, but I can't figure out how to act on only one of the text files. The text PDF files have a unique string as part of the file name that I could use to search or select by.
I could split the files apart into different output connections if necessary, as long as I can bundle everything up at the end. But I don't see a way of letting only one file through a connection when several of them would meet the criteria.
Acting on only one file from a job folder
- JimmyHartington
- Advanced member
- Posts: 329
- Joined: Tue Mar 22, 2011 7:38 am
Re: Acting on only one file from a job folder
You could try to ungroup the folder.
And then only route files with the unique string.pdf
Can you define the pattern of the unique string with RegEx?
Try to supply a sample of some folder structures you need to process.
And then only route files with the unique string.pdf
Can you define the pattern of the unique string with RegEx?
Try to supply a sample of some folder structures you need to process.
Re: Acting on only one file from a job folder
J12345_C1252365_cvr.pdf
J12345_C1252365_text.pdf
J12345_C2544758_cvr.pdf
J12345_C2544758_text.pdf
J12345_C2587435_cvr.pdf
J12345_C2587435_text.pdf
J12345_C2587456_cvr.pdf
J12345_C2587456_text.pdf
J12345_C3654785_cvr.pdf
J12345_C3654785_text.pdf
J12345_C8524712_cvr.pdf
J12345_C8524712_text.pdf
J12345_C9587456_cvr.pdf
J12345_C9587456_text.pdf
All the text files have the same number of pages, but there is nothing in the file names or the folder they come in to indicate how many pages. There are 7 different possible page counts. I want to send only 1 text file through to the part of the flow the checks the number of pages. There is no reason to check all of them and there could be up to 100 in each batch. All the covers and all the other text files would go through another part of the flow and be rejoined later. The problem is there is no way to distinguish one text file from another.
I may have to resort to a script.
J12345_C1252365_text.pdf
J12345_C2544758_cvr.pdf
J12345_C2544758_text.pdf
J12345_C2587435_cvr.pdf
J12345_C2587435_text.pdf
J12345_C2587456_cvr.pdf
J12345_C2587456_text.pdf
J12345_C3654785_cvr.pdf
J12345_C3654785_text.pdf
J12345_C8524712_cvr.pdf
J12345_C8524712_text.pdf
J12345_C9587456_cvr.pdf
J12345_C9587456_text.pdf
All the text files have the same number of pages, but there is nothing in the file names or the folder they come in to indicate how many pages. There are 7 different possible page counts. I want to send only 1 text file through to the part of the flow the checks the number of pages. There is no reason to check all of them and there could be up to 100 in each batch. All the covers and all the other text files would go through another part of the flow and be rejoined later. The problem is there is no way to distinguish one text file from another.
I may have to resort to a script.
- JimmyHartington
- Advanced member
- Posts: 329
- Joined: Tue Mar 22, 2011 7:38 am
Re: Acting on only one file from a job folder
Is J12345 a unique indikator pr. job?
So the next job could be J23456?
If so is it always 5 numbers?
So the next job could be J23456?
If so is it always 5 numbers?
Re: Acting on only one file from a job folder
Yes, all the files with a specific J number come in in a zip file which I am unzipping in a prior step. All the text files within one J number have the same number of pages. I almost have a script written to do this part ahead of switch so it's not urgent.
- JimmyHartington
- Advanced member
- Posts: 329
- Joined: Tue Mar 22, 2011 7:38 am
Re: Acting on only one file from a job folder
I think this flow does what you need.
![Image](https://d.pr/i/M4u9gF+)
Download here: https://d.pr/f/zAQgiE+
The trick I use is to split all text-files in one folder. Here I set private data to number of pages. Which you mentioned are the same.
Then assemble the job based on the ungrouped job. And here it is important to merge metadata. Because then the private data for number of pages for text files is available for the rename part.
Look at the flow and see if it works for you.
Download here: https://d.pr/f/zAQgiE+
The trick I use is to split all text-files in one folder. Here I set private data to number of pages. Which you mentioned are the same.
Then assemble the job based on the ungrouped job. And here it is important to merge metadata. Because then the private data for number of pages for text files is available for the rename part.
Look at the flow and see if it works for you.
- JimmyHartington
- Advanced member
- Posts: 329
- Joined: Tue Mar 22, 2011 7:38 am
Re: Acting on only one file from a job folder
Did you ever get this to work?