INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

append txt in dir to a big file

append txt in dir to a big file

(OP)
I have in c:\mydir\:
test.txt
test1.txt
aaa.txt
...
rrr.txt

i need to loop in dir and append all .txt file from c:\mydir\ in a big.txt file in c:\mydir1\big.txt

how to?

note:
the dimension of sigle .txt file is approx 20/30 Mb

RE: append txt in dir to a big file

So, what have you tried so far?

RE: append txt in dir to a big file

Simply appending files without any other logic is a work for system commands.
It would be easy done in one command file:

append_files.cmd

CODE

@echo off
echo Appending files to .\result\big.txt
for %%i in (.\*.txt) do (
  echo appending: %%i
  type %%i >> .\result\big.txt
)
echo Done. 

RE: append txt in dir to a big file

(OP)
hi mikrom tks for code, sorry me, but i'm in vb6.

... and i need to substituite .\ with my path c:\mydir\?

RE: append txt in dir to a big file

Quite. There are a load of non-VB ways of doing this. E.g. a Powershell variant (and there are loads of ways of doing it in Powershell):

Get-Content (Get-ChildItem -Filter *.txt)>merged.txt

RE: append txt in dir to a big file

Quote (2009luca)


... sorry me, but i'm in vb6
... and i need to substituite .\ with my path c:\mydir\?
It would be not problem to pass to the script your path as a command line argument.

But if like to write it in Visual Basic, maybe this little example I posted some time ago in VBscript forum could help you a little bit:
I guess in VB6 should it be very similar.

http://www.tek-tips.com/viewthread.cfm?qid=1700969




RE: append txt in dir to a big file

@mikrom, try not to step on another member's response. Strongm posed his first response for a purpose that required the OP to respond. Might have been good to know where the OP had progressed to in order to understand where the next step might be. You came in like a bull in a china shop. O.L.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: append txt in dir to a big file

@SkipVought
I apologize.
Yes it's my bad habit be impatient and try to solve everything as quickly as possible.

RE: append txt in dir to a big file

S'ok, I'll live ...

RE: append txt in dir to a big file

This is for the benefit of the OP and other browsers.glasses

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: append txt in dir to a big file

2009luca, did mikrom's code provide you with a solution?

RE: append txt in dir to a big file

(OP)
sorry but very busy...
in other case the code work perfect!
Tks

RE: append txt in dir to a big file

If the "other case the code work perfect!", doesn't the "other case"'s post deserve a star? ponder

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close