Solved

renames existing folders during run time

Posted on 2004-11-02
234 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
Question by:dkim18
    5 Comments
     
    LVL 37

    Expert Comment

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

    Accepted Solution

    by:
    0
     
    LVL 5

    Expert Comment

    by:Naeemg
    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
    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
    Thanks for accepting
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Lean Six Sigma Project Manager Certification

    There are many schools of thought around successful project management, but few as highly regarded as the Six Sigma and Lean methods. With 37 hours of learning, this training will explain concrete processes for increasing efficiency and limiting wasted time and effort.

    Suggested Solutions

    For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
    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…
    Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
    This video teaches viewers about errors in exception handling.

    913 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now