Announcement

Collapse
No announcement yet.

Merge script does not merge in order 1, 2, 3.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Merge script does not merge in order 1, 2, 3.

    Hi

    The problem is that the merge is not done in order.
    Instead of merging 1, 2, 3.. it merges 1, 10, 11, 12, 2, 20, 21 and so
    on..

    The files (NewTestData_1.txt;1) are auto generated and i'm unable to make changes to the naming convention.

    Anyone got some good advise to solve this?


    Thanks in advance.


    ------------------------------------
    Option Explicit


    dim oArgs: Set oArgs = WScript.Arguments


    Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")


    dim filefolder
    Dim filefolderN
    Dim CurrentFolder
    Dim Files
    Dim File
    dim objts
    dim strContents
    dim endoffilepos


    filefolder = "C:\Test\"
    filefolderN = "C:\Test\Data\"
    Set CurrentFolder = fso.GetFolder(filefolder)
    Set Files = CurrentFolder.Files


    For Each fileName In files
    If left(File.Name,13) = "NewTestData_1" Then
    Set objTS = File.OpenAsTextStream(1)
    strContents = objTS.ReadLine
    objTS.Close


    Set objTS = fso.OpenTextFile(filefolderN & "\NewTestData.", 8,true)
    objts.writeline strContents
    objts.close


    Set objTS = fso.OpenTextFile(filefolder & "\NewTestData.log", 8, true)
    strContents = "Merge Completed for " & File & vbcrlf
    objts.write strContents
    objts.close


    File.delete
    end if
    Next

  • #2
    Re: Merge script does not merge in order 1, 2, 3.

    It's merging in alphanumeric order. Can you change the sort or search paradigm so that it sorts in strict Numerical order instead?


    Tom
    For my own and your protection, I do not provide support by private message under any circumstances. All such messages will be deleted and ignored.

    Anything you say will be misquoted and used against you

    Comment

    Working...
    X