• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • Last Modified:

renames existing folders during run time

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
dkim18
Asked:
dkim18
  • 3
  • 2
1 Solution
 
zzynxSoftware engineerCommented:
use File.renameTo(File other)
0
 
zzynxSoftware engineerCommented:
0
 
NaeemgCommented:
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
 
NaeemgCommented:
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
 
zzynxSoftware engineerCommented:
Thanks for accepting
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now