Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

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