• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to creat a directory?  RSS feed

 
Maha Hassan
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All
i want to creat a directory and then add a file to it
well i know how to creat a file
File test = new File (file path);
and i know to test wheather or not this is a directory
BUT!! how to CREAT a directory in the first place
please help me
thanks
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the File.mkdir() and File.mkdirs() methods; they create one directory or a hierarchy of directories, respectively.
 
Maha Hassan
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
both are boolean
i want to set the file to a directory
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read the documentation: they create a directory, and return true or false to indicate success.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Maha Aburahma:
well i know how to creat a file
File test = new File (file path);


This does not create a file.
It creates a File object that represents an operating system file, but that file will not be created by this call.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!