Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file upload and change directory

Status
Not open for further replies.

abyinsydney

Programmer
Feb 17, 2004
99
AU
Greetings fellow citizens

I'm designing an application where files would be recieved from the extracts in the form of text files .i have to design an application in java such that once the text files are processed(uploaded in the database)there are moved to a different directory.can some let me know how to move the file to a different directory i've succeeded in uploading to the database.

How do imove the file to a different directory once they are uploaded

thnax in advanc
 
Hi,

To move the file to a different directory

// File to be moved
File file = new File("fileName");

// Destination directory
File directory = new File("directoryName");

// Move file to new directory
boolean move = file.renameTo(new File(directory, file.getName()));
if (move) {
// File successfully moved
}else{
// Unable to move the file
}

Cheers,
Venu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top