Wednesday, November 3, 2010

Create Folder in Java Example

import java.io.File;
/**
 * @author mallikarjung
 *
 */
public class FolderCreation {
    public static String folderPath = "D:/SampleFolder/";
    /**
     * @param args
     */
    public static void main(String[] args) {
        File folder = new File(folderPath);
        //check whether folder exists or not
        if(!folder.exists()){
            folder.mkdir();
            System.out.println("Folder has been created Successfully ... ");
        }
    }
}

No comments: