+ 1

I want to input many files like a folder or select some of a folder

8th Oct 2016, 2:21 PM
Madhvendra Krishna
Madhvendra Krishna - avatar
2 Respuestas
+ 1
String path = "C:" + File.separator + "hello" + File.separator + "hi.txt"; // Use relative path for Unix systems File f = new File(path); f.getParentFile().mkdirs(); f.createNewFile(); // try this
11th Feb 2017, 12:00 PM
Towhid Hasnein
Towhid Hasnein - avatar
0
You have to use a loop to input all the file names in an array : while(input.hasNext()) // Loop until end-of-line arr[i] = input.nextLine(); // character input is the object of Scanner. Now use this array 'arr' to read the filenames. OR If you are selecting a folder, then use 'File' object to list all the containing files : if(fileobj.isDirectory()) //checking for directory arr[] = fileobj.list(); //inputting the contents of folder Its not a complete code but a guideline. I hope this helps you. Happy Coding!
9th Oct 2016, 7:23 AM
Harshdeep Singh
Harshdeep Singh - avatar