469,311 Members | 2,514 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,311 developers. It's quick & easy.

Creating a new folder using java

Hi freinds,
Is it possible to create a new folder in a given directory using java..?
I need to create the directory and then copy some images into the same..

Thanks
Nov 14 '07 #1
5 23870
JosAH
11,448 Expert 8TB
Hi freinds,
Is it possible to create a new folder in a given directory using java..?
I need to create the directory and then copy some images into the same..

Thanks
Have a look at the FileSystemView class; it can create directories given
an abstract path (a File object).

kind regards,

Jos
Nov 14 '07 #2
Thanks for the concern..
But I need the exact implementation of the abstract function createNewFolder..
Please help..
Nov 14 '07 #3
JosAH
11,448 Expert 8TB
Thanks for the concern..
But I need the exact implementation of the abstract function createNewFolder..
Please help..
The FileSystemView has a static factory method that gives you an implementation
of the abstract FileSystemView class. Check the API documentation again.

kind regards,

Jos
Nov 14 '07 #4
Hi freinds,
Is it possible to create a new folder in a given directory using java..?
I need to create the directory and then copy some images into the same..

Thanks
you can use filename.mkdir(); for creating new directory.
Nov 15 '07 #5
Expand|Select|Wrap|Line Numbers
  1. import java.io.*;
  2. public class FolderCreate {
  3.  
  4.     public static void main(String args[]){
  5.     File f = new File("C:\\TEST");
  6.     try{
  7.         if(f.exists()==false){
  8.             f.mkdir();
  9.         System.out.println("Directory Created");
  10.         }
  11.         else{
  12.         System.out.println("Directory is not created");
  13.         }
  14.     }catch(Exception e){
  15.         e.printStackTrace();
  16.        }
  17.     }
  18. }
Oct 28 '10 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by dbaplusplus | last post: by
1 post views Thread by geniusamita | last post: by
3 posts views Thread by SelvaSA | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.