Hi,
I am trying to use Directory Input to pull in an Excel file each month. The filenames are consistent and I'm familiar with how to pull the most recent file in the directory. However, this time, I want the 2nd file in the directory. Not the most recent, but the one before that. Using my normal Directory Tool > Sort > Sample > Dynamic Input doesn't seem to be the way to go. I've got Sample set to skip the first 1 rows but that only works right now because there are 2 files in the directory. Any suggestions? Thanks!
Solved! Go to Solution.
Hi @KateC .
A quick method I can think of is by using a combination of 2 sample tools:
1. 1st sample tool to skip the 1st row (what you are already doing)
2. 2nd sample tool to choose the 1st row
This way you will always be selecting the 2nd row/ file, no matter how many files there are in the directory.
If you need a more dynamic approach, perhaps you can consider using "wildcard * names".
Perhaps what you're missing is to sort the directory file list by Creation Time, Descending. First. Then Select Records the second record.
That's great! I just took out the Sample and replaced with Select Record. Works perfectly. Thank you
Happy to help : ) @KateC
Cheers and have a nice day!
If your Directory listing has only one file, do you want to keep that file? Does your selected solution work with only one file?
These tools keep the send record, or the first record if there is only one:
Chris