none
FILE Adapter to get all files in subdirectories RRS feed

  • Question

  • Hi all,

    I need to retrieve file from about 3000 subfolders from BizTalk. I don't want to create 3000 receive locations.

    I'm searching for a solution that provides me a way to get files from a root directory and in all subdirectories. If I can avoid creating my own adapter, it could be great :)

    Thanks.

    Monday, January 20, 2014 2:16 PM

Answers

  • Here are some solutions:

    1. Customize the sample File Adapter in the BizTalk SDK to scan on all subfolders.

    2. Use a Windows Scheduled Task to sweep the subfolders into a single folder.  You'd have to handle naming conflicts.

    #1 is a relatively easy modification and the path I would recommend.

    • Marked as answer by Pengzhen Song Wednesday, February 5, 2014 2:39 AM
    Monday, January 20, 2014 6:14 PM

All replies

  • Here are some solutions:

    1. Customize the sample File Adapter in the BizTalk SDK to scan on all subfolders.

    2. Use a Windows Scheduled Task to sweep the subfolders into a single folder.  You'd have to handle naming conflicts.

    #1 is a relatively easy modification and the path I would recommend.

    • Marked as answer by Pengzhen Song Wednesday, February 5, 2014 2:39 AM
    Monday, January 20, 2014 6:14 PM
  • Think it can be achieved using Custom file adapter. Other options may be having some .Net code within Orchestration to read all the files.

    We can also read all the files and keep it in a single folder using some services before processing, but in this case we will loose the Original receive location context properties.

    Tuesday, January 21, 2014 1:18 AM
  • Hi,

    you can make one windows service say "File Watcher Service", which will have a watch on the main directory and its sub folder, if any file fall in any of those sub folder in the directory it will pick the file and put it in common folder.

    now point your receive adapter to that common folder, now your biztalk engine will work as normal.

    Hope it will help.


    Tuesday, January 21, 2014 7:45 AM
  • Hi David,

    Below options may be helpful for you, 

    1. create a windows service to poll all the subdirectories and move it to one common/Master location and then make Biztalk to pick from that location

    For a long term perspective, Create a logic and use a SQL table to map multiple receive location to one master location, which can be used for further addition of locations

    you can use any of the below methods for it

    Directory.GetFiles(dirPath, "*", SearchOption.AllDirectories)

    (or)

    public static List<String> GetAllFiles(String directory)

     { return Directory.GetFiles(directory, "*.*", SearchOption.AllDirectories).ToList(); }

    2.Create a Custom adapter, in which use the properties, to pass the receive locations by delimited values

    Reference to create a Custom Adapter

    http://biztalkadapterwizard.codeplex.com/

    3. Case study for creating multiple receive location, for FTP adapter

    http://geekswithblogs.net/bloesgen/archive/2008/05/13/122120.aspx

    I feel the option 1 would be suitable for long term perspective.


    Regards, Vignesh S

    • Proposed as answer by Vignesh Sukumar Wednesday, January 22, 2014 6:19 AM
    Tuesday, January 21, 2014 5:02 PM
  • Hi all,

    How to create a Custom file adapter?

    if you have samples or guideline links please give me.

    thanks advance!

    Thursday, January 23, 2014 8:38 AM
  • The easiest thing to do is modify the File Adapter sample that comes with the BizTalk SDK.  Look in SDK\Samples\AdaptersDevelopment.
    Thursday, January 23, 2014 1:25 PM
  • Thank Boatseller for your information,

    Regards.
    Friday, January 24, 2014 8:43 AM