09 Mar 2008 @ 9:08 PM 
 

Copy a txt file from one location to another with Java

 


1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 4 out of 5)
Loading ... Loading ...
1,055 views

I’ve wrote a simple txt file copy class that copies the contents of one txt file to another location because I noticed that a few people were looking for a way to copy textfiles from one location to another so I wrote this class to handle this. Have fun with it. If you have any comments or suggestions to improve this application let me know by makeing a comment!

Here’s the main code to test the class:

/*————————————————————————–
//Author List:
// deAppel <Creator>
//
//Description:
// copy the contents of one *.txt file to another *.txt file.
//
// feature(s):
// Copy a file to another one
//
// How to use:
// CopyFiles.copyFile(String from, String to) Copy the txt file from one location to another.
//
// Known issue(s):
//
// Working on:
//
// Ark de Appel - www.engineeringserver.com
//———————————————————————-*/
import engineeringservercomUtilityPackage.CopyFiles;

public class CopyFileTest {
public static void main(String[] args){
CopyFiles CF = new CopyFiles();
CF.copyFile(”c:\\input.txt” , “c:\\output.txt”);
}
}
To copy the file you must create a CopyFiles object and call the copyFile method like this:
CF.copyFile(”c:\\input.txt” , “c:\\output.txt”);

Error handling:
The application will automaticly create the output.txt if the file doesn’t exist.
The application will generate a textmessage if the input text cannot be found.

Download the files here:
http://www.engineeringserver.com/Software/CopyFileTest.rar

Random posts

Your Ad Here
Tags Categories: Java Posted By: HappyFace
Last Edit: 16 Aug 2008 @ 06 43 PM

EmailPermalink
 

Responses to this post » (2 Total)

 
  1. [...] Engineeringserver.com An open source blog for computer science students and Java developers ← Copy a txt file from one location to another with Java [...]

  2. [...] see my reply above, you can use this class i wrote to copy files from one directory to another: Engineeringserver.com | Copy a txt file from one location to another with Java to process it automatcally you can use a thread that checks the unprocessed folder every second [...]

Post a Comment

You must be logged in to post a comment.

\/ More Options ...
Change Theme...
  • Users » 888
  • Posts/Pages » 1,444
  • Comments » 506
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

Online Users



    No Child Pages.

Forum



    No Child Pages.