Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

renames existing folders during run time

Posted on 2004-11-02
7
Medium Priority
?
236 Views
Last Modified: 2010-03-31
Is there any ways that I can renames existing folders during run time?

For example:
While the program that I am working on needs to create hdr files (base on File1, File2 and File3) under “Folder_four” dir and rename “Folder_four” dir and “Folder_three” dir during run time.

Folder_one
   Folder_two
      Folder_three ß need to change
         Folder_four  ß need to change
      Subfolder_one
            File1
      Subfolder_two
            File2
      Subfolder_three
            File3
      

0
Comment
Question by:dkim18
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
7 Comments
 
LVL 37

Expert Comment

by:zzynx
ID: 12474058
use File.renameTo(File other)
0
 
LVL 37

Accepted Solution

by:
zzynx earned 800 total points
ID: 12474065
0
 
LVL 5

Expert Comment

by:Naeemg
ID: 12480586
use this code. if folder does not exist then u 've to create, if ur folder already exist then omit line 2.

    File oldFolder = new File("c:\\Folder_three");
    oldFolder.mkdir();
    File newFolder = new File("c:\\Folder_three_Renamed");
    oldFolder.renameTo(newFolder);
0
 
LVL 5

Expert Comment

by:Naeemg
ID: 12490487
well, I thought answered posted before me is not more precisely to asker. so i posted detailed code that may help asker in sophisticated way.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12490779
Thanks for accepting
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Suggested Courses

618 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