Solved

re-naming a file

Posted on 2013-11-08
2
97 Views
Last Modified: 2013-11-14
hi guys

I want to rename a file , so the new file will have the new name and all contents from old file
Is there a simple way to do this?

is this correct?

for (final File fileEntry : folder.listFiles()) {
String newFileName = fileEntry.getName()+".RENAMED";
File newFile = new File(fileEntry.getParent(), newFileName);
}

Open in new window

0
Comment
Question by:royjayd
  • 2
2 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 400 total points
ID: 39633500
That's ok
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 39648470
:)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question