Setting Output File Name


    Setting Output File Name

    By default the output file name created used the following format: <OriginalFileName><file number><extension>. For example, if two files are generated as the result of the splitting a file named “EDIData”, the following two files will be created in the output directory:

    · EDIData1.txt
    · EDIData2.txt

    The format of the output file name can be changed by setting the OutputFilenameFormat and the OutputFilename property.


    EDIFileSplitter ediFileSplitter = new EDIFileSplitter();
    // Split the file at the header level (ST segment)
    ediFileSplitter.FileSplitLevel = FileSplitLevel.HEADER;
    // Place 2 ST headers per file
    ediFileSplitter.NumberOfHeadersPerFile = 2;
    ediFileSplitter.OutputFilename = “Test”;
    ediFileSplitter.OutputFilenameFormat = “{0}_{1}{2}”;
    ediFileSplitter.Split(“EDIData”, Directory.GetCurrentDirectory());

    The output file name will now be Test_1.txt.

    The GeneratePseudoRandomNumberInFilename property will generate a unique number for each split file. The unique number is total milliseconds since the last epoch, January 1, 1970.

    in EDI File Splitter
    Did this article answer your question?