Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how can I append two files  RSS feed

 
Dhan Priyan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai
any one tell me how can i append two files in java.

but these are the steps to be done:

note: directory1 & directory2 contains same files mostly

1- read the file1 from the directory1 // it is fine for me
2- read the file2 from the directory2 // it is fine for me

3- later i need to append file2 contents to the end of the file 1. // in this part i am lost with code.

thanks
Priyan
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37044
505
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Priyan,
Do you know how to write to a file? It's basically the same code except you pass a different boolean value for append when you create the writer.
 
Dhan Priyan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the kind reply.
i was playing with this code, but i could not understand where to give the file names.
it might help me to link the directory part with this code later.



 
Too many men are afraid of being fools - Henry Ford. Foolish tiny ad:
Thoughts on deprecation in Java
https://coderanch.com/t/683016/java/Deprecation-Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!