Jump to content

Append one text.txt file to another text2.txt file


Recommended Posts

I have looked, leaving almost no stone unturned, does abody know a simple way, not just to filewriteline or filewrite, but to append an entire text file to another textfile, perhaps ClipPut/ClipGet with a $string variable, sorry I'm very new here, forgive my ignorance. :D

Link to comment
Share on other sites

I have looked, leaving almost no stone unturned, does abody know a simple way, not just to filewriteline or filewrite, but to append an entire text file to another textfile, perhaps ClipPut/ClipGet with a $string variable, sorry I'm very new here, forgive my ignorance. :D

you could just....

$file1 = FileRead("c:\file1.txt")
$file2 = FileOpen("C:\file2.txt",1)
FileWrite($file2,@CR & $file1)
Link to comment
Share on other sites

cameronsdad Great!! thx for your quick response u make this look easy.....

no problem man, i'm always glad to help. and it just gets easier and easier as you go along.

***edit***

P.S. Welcome to the forum

Edited by cameronsdad
Link to comment
Share on other sites

  • 1 month later...

Hi,

I am getting an error message when I used this code , for appending the files. Actually for "FileRead" we need to give one more parameter that is the "count".

I need to append the whole file to another. How can I do this ? Could some one help ?

Vinod

Link to comment
Share on other sites

Yea certainly. He just wrote some quick apparently psuedo code.

$file1 = FileRead("c:\file1.txt", FileGetSize("c:\file1.txt"))
$file2 = FileOpen("C:\file2.txt",1)
FileWrite($file2,@CR & $file1)
FileClose($file2) ;Note: $file1 should close itself due to only using FileRead()

I hope this further helps you in your Adventures with AutoIt.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Yea certainly. He just wrote some quick apparently psuedo code.

$file1 = FileRead("c:\file1.txt", FileGetSize("c:\file1.txt"))
$file2 = FileOpen("C:\file2.txt",1)
FileWrite($file2,@CR & $file1)
FileClose($file2) ;Note: $file1 should close itself due to only using FileRead()

I hope this further helps you in your Adventures with AutoIt.

JS

actually, my example assumed beta, which has the second parameter as optional with the default value being the entire file. only in 3.1.1 the count is a required parameter. beta is betta'
Link to comment
Share on other sites

simple way to concatentate files

concatanate foo and bar to foo.bar

copy foo + bar foo.bar

OR

type foo > foo.bar

type bar >> foo.bar

using wildcards is also permitted....

copy *.foo foofiles

"the console is your friend"....

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Link to comment
Share on other sites

actually, my example assumed beta, which has the second parameter as optional with the default value being the entire file. only in 3.1.1 the count is a required parameter. beta is betta'

AutoIt's Beta is definitely better. I didnt know that being an optional param in beta. Thanks for the tip. I'll remember that.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

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