Jump to content
Sign in to follow this  
DSIS

File manipulation

Recommended Posts

DSIS

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.

Share this post


Link to post
Share on other sites
Andreik

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

Share this post


Link to post
Share on other sites
Andreik

#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

Share this post


Link to post
Share on other sites
Xandl

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

Share this post


Link to post
Share on other sites
DSIS

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

Share this post


Link to post
Share on other sites
DSIS

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.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.