Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

merge all text files in a given folder using windows scripting

  • 06-08-2005 05:10PM
    #1
    Registered Users, Registered Users 2 Posts: 68 ✭✭


    Please help

    I can combine the contents of 2 .txt files but I can't seem to make the evolutionary leap of merging all .txt files into a new .txt file.

    see this sample all suggestions appreciated

    Set txtFile1=FSO.OpenTextFile(File1,1)

    Set txtFile2=FSO.OpenTextFile(File2,8)
    Do while txtFile1.AtEndOfline <> True
    txtFile2.writeline(txtFile1.readline & vbcr)
    Loop
    txtFile1.close
    txtFile2.close


    alan :cool:


Comments

  • Registered Users, Registered Users 2 Posts: 288 ✭✭gordonnet


    you can use a batch file: eg merge.bat

    @echo off
    type *.txt >> report.log
    ren report.log report.txt


  • Registered Users, Registered Users 2 Posts: 68 ✭✭alancool


    I currently use a batch file to accomplish this merge but I've been asked to skool up on an alternative script host method.

    This will ultimately be a subroutine in a larger script... hopefully!

    Thanks again... this also works in the bat file given a naming convention.

    ECHO OFF
    copy ??-??-2005.txt+log.txt


    alan :cool:


Advertisement