LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-24-2015, 07:09 AM   #1
manolakis
Member
 
Registered: Nov 2006
Distribution: xubuntu
Posts: 464

Rep: Reputation: 37
renaming files in Java


Dear all,

I have a written a TCP Client/Server application where clients can upload files to a server
My main problem is that when an upload is finished I can not rename the file. First a part file is created so if the user wants to upload a file called 'myfile.pdf' the server will save data into a file called 'myfile.pdf.part'. What I want to do is at the finish of the upload to rename the file from 'myfile.pdf.part' to 'myfile.pdf'.

I tried the File.renameTo(File) method in the Java File API but it did not work. I also tried the FileUtils apache commons API but neither this worked.

Can anyone please advise me how is to possible to rename or move in a unix style a file?
 
Old 01-25-2015, 12:37 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,863
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Exactly what did you try (source code), and exactly what error message did you get (quote it)?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Renaming Files..Help npeddle Linux - Newbie 9 12-20-2010 02:17 PM
Renaming files tekmann33 Linux - Newbie 6 05-22-2009 10:08 AM
Renaming files leupi Linux - General 5 09-16-2008 03:22 AM
help renaming files balistic Linux - Newbie 4 07-29-2007 08:04 AM
Renaming files in one go saurya_s Linux - Software 1 01-12-2004 01:16 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration