How do i creat folders using JAVA..

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: May 2007
Posts: 3
Reputation: shriyash134 is an unknown quantity at this point 
Solved Threads: 0
shriyash134 shriyash134 is offline Offline
Newbie Poster

How do i creat folders using JAVA..

 
0
  #1
May 31st, 2007
HI there,
The program which I am working on involves reading XML document and then depending on the input data save the output files(text) in different folders...can any body tell me where do i find tutorials which can help me in doing this....
I need help ..

waiting for response

shriyash.
Shriyash.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,503
Reputation: Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of 
Solved Threads: 521
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: How do i creat folders using JAVA..

 
0
  #2
May 31st, 2007
There are two commands available on a File object to create a directory. File.mkDir() will create just the directory specified by the File object. All parent directories must already exist. The second method, File.mkDirs() will create any necessary directories to create the entire path specified.
  1. // if ParentDir exists, this invocation will work
  2. File targetDir = new File("c:/ParentDir/TargetDir");
  3. if (!targetDir.exists())
  4. targetDir.mkDir();
  5.  
  6. // if ParentDir may not exist yet, you can use
  7. // mkDirs() instead and all directories will be created
  8. File targetDir = new File("c:/ParentDir/TargetDir");
  9. if (!targetDir.exists())
  10. targetDir.mkDirs();
Last edited by Ezzaral; May 31st, 2007 at 12:26 pm. Reason: added a bit of example code
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 3
Reputation: shriyash134 is an unknown quantity at this point 
Solved Threads: 0
shriyash134 shriyash134 is offline Offline
Newbie Poster

Re: How do i creat folders using JAVA..

 
0
  #3
May 31st, 2007
hey Ezzaral.
thanx a lot....can u plz help me with the bold part which i have mentioned in my thread....i.e" reading XML document with a JAVA program and then depending on the input data save the output files(text) in different folders
I am new to java programming and wud be very gratefull if you can suggest me with some tutorial links with which i can do this task.

shriyash.
Shriyash.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,503
Reputation: Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of 
Solved Threads: 521
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: How do i creat folders using JAVA..

 
1
  #4
May 31st, 2007
You will need to use an XML parser to read the files for processing. If you are using J2SE5.0 or above, JAXP provides built-in XML libraries. If you are using earlier versions of Java, you will need to download a parser such as JDOM or Xerces (easily found with Google). If you use JAXP, you can find many tutorials on processing XML in Java at http://java.sun.com/webservices/jaxp...ial/index.html
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC