Jump to content

File manipulation


Recommended Posts

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.

Link to comment
Share on other sites

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)?

When the words fail... music speaks.

Link to comment
Share on other sites

#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)

When the words fail... music speaks.

Link to comment
Share on other sites

#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.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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