After Merge txt files to txt file

KisuKisu Posts: 381Member
How do I combine all the part object txt files in to one, or is there ez way to import them all back to nav?

Edit: Sorry, noticed the merge option in the splitter late :mrgreen:
K.S.

Answers

  • WaldoWaldo Posts: 3,412Member
    You should write some kind of procedure to merge them into one ... it's quite easy in NAV.

    Something like:
    //F and F2 have datatype "File"
    //vartxtFileName is the variable that contains the name of the concatenated file
    //recFile has datatype record and subtype "File"
    //vartxtDir contains the directory with all the files that has to be concatenated
    //Texte had datatype Text of 1024 chars
    
    F.TEXTMODE(TRUE);
    F.WRITEMODE(TRUE);
    IF NOT F.CREATE(vartxtFileName) THEN
      ERROR('Unable to create %1', vartxtFileName);
    
    recFile.SETRANGE(Path,vartxtDir+ '\');
    recFile.SETRANGE("Is a file",TRUE);
    IF recFile.FINDSET THEN
    REPEAT
     F2.TEXTMODE := TRUE;
     F2.OPEN(vartxtDir +'\'+recFile.Name);
     F2.READ(Texte);
     REPEAT
       F.WRITE(Texte);
     UNTIL fleTable.READ(Texte) = 0;
     F2.CLOSE;
    UNTIL recFile.NEXT = 0;
    
    F.CLOSE;
    

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • WaldoWaldo Posts: 3,412Member
    Kisu wrote:
    Edit: Sorry, noticed the merge option in the splitter late :mrgreen:

    Lol ... oops .
    Anyway, above is another way to go :wink:

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • wyewye Posts: 1Member
    Another way to go, it's quite easy in MS-DOS:
    copy *.txt all.txt
    

    And then just import the all.txt file.
  • WaldoWaldo Posts: 3,412Member
    works like a charm and good tip!
    :thumbsup:
    :)

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • primeapprimeap Posts: 36Member
    edited 2019-08-07
    A neat trick to first copy all txt from all subfolders is:
    for /R %a in (*.txt) do @copy /y "%a"
    
    then merge
    copy *.txt all.txt
    
  • KisuKisu Posts: 381Member
    primeap wrote: »
    wye wrote: »
    Another way to go, it's quite easy in MS-DOS:
    copy *.txt all.txt
    

    And then just import the all.txt file.

    A neat trick to merge all txt from all subfolders is:
    for /R %a in (*.txt) do @copy /y "%a" all.txt
    

    Nice reply. Even its almost 10 year old post ^^
    K.S.
Sign In or Register to comment.