Making Directories:
There are two valuable File utility methods, which can be utilized to make directories:
The mkdirs() method makes both a directory and all the elements of the index.
The mkdir( ) method makes a directory, returning valid on achievement and false
on disappointment. Failure demonstrates that the way determined in the File object
exists, or that the index can’t be made in light of the fact that the whole way does
not exist yet.
Sample Implementation:
import java.io.File;
public class MyCreateDir {
public static void main(String args[]) {
String directoryname = “/tmp/user/java/bin”;
File dir = new File(directoryname);
dir.mkdirs();
}
}
Do'stlaringiz bilan baham: |