Jump to content

Recommended Posts

Posted

I need to concatenate all the files in a directory into one large file. I do not know the names of the files. I only know the directory they are located. I am not sure where to start. Can someone point me in the right direction. Thanks.

Posted

I need to concatenate all the files in a directory into one large file. I do not know the names of the files. I only know the directory they are located. I am not sure where to start. Can someone point me in the right direction. Thanks.

What type of files (txt)?
Posted

#include <File.au3>

$FILES = _FileListToArray(@ScriptDir,"*.txt",1)
$FILE = FileOpen(@ScriptDir & "\ALL.TXT",2)
For $INDEX = 1 To $FILES[0]
    $FILE_OPEN = FileOpen(@ScriptDir & "\" & $FILES[$INDEX],0)
    $DATA = FileRead($FILE_OPEN)
    FileClose($FILE_OPEN)
    FileWrite($FILE,$DATA & @CRLF)
Next
FileClose($FILE)

Posted

Hello,

this sounds like a dos commandline job.

You could use

cd /d c:\path\to\textfiles

copy * c:\another\path\all.txt

ciao

Xandl

Posted

#include <File.au3>

$FILES = _FileListToArray(@ScriptDir,"*.txt",1)
$FILE = FileOpen(@ScriptDir & "\ALL.TXT",2)
For $INDEX = 1 To $FILES[0]
    $FILE_OPEN = FileOpen(@ScriptDir & "\" & $FILES[$INDEX],0)
    $DATA = FileRead($FILE_OPEN)
    FileClose($FILE_OPEN)
    FileWrite($FILE,$DATA & @CRLF)
Next
FileClose($FILE)

Thanks. With a few tweaks this worked well.

Posted

Hello,

this sounds like a dos commandline job.

You could use

cd /d c:\path\to\textfiles

copy * c:\another\path\all.txt

ciao

Xandl

Thanks. I will try this.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...