Inner join on 2 arrays?

Posted by russ on Stack Overflow See other posts from Stack Overflow or by russ
Published on 2010-03-17T21:30:00Z Indexed on 2010/03/17 21:31 UTC
Read the original article Hit count: 282

Filed under:

I'm trying to find a solution to the following (I'm thinking with Linq) to the following:

I need to pull down certain files from a larger list of files on an ftp server that have a similar file name. For example, we send an order file to some company for processing then they return a response file that we can download.

So, I could send them the files "order_123.txt" and "order_456.txt". After a certain amount of time I need to go look for and download the responses for those files that will be named "order_123.resp" and "order_456.resp". The kicker is that in some cases I can have multiple responses in which case they would create "order_123-1.resp" and "order_123-2.resp" and also the files don't get removed from the server.

I know this can be accomplished by looping through the files I know I need responses to then loop through all the files on the server until I find files that match but I'm hoping that I don't have to loop through the files on the server more than once.

This example may help clarify:

I've sent "order_222.txt" and "order_333.txt" they processed them and the ftp server contains: "order_111-1.resp" "order_001.resp" "order_222-1.resp" "order_222-2.resp" "order_333.resp"

I need to download the 3rd, 4th, and 5th file.

Thanks.

© Stack Overflow or respective owner

Related posts about LINQ