Monday, 16 July 2012

create a new folder in java

 String desktopPath = System.getProperty("user.home") + File.separator + "Desktop" + File.separator + "NW Folder";

 File folder = new File(desktopPath);

if(!folder.exists())
{
      folder.mkdirs();
}

A new folder with name (NW Folder ) will be created if there is no folder in the given name specified.

Folder within folder also can be created with this .

No comments:

Post a Comment