I have a folder (some root folder) in my computer that contains a lot of folders and files. I need to create a String Array that contain all paths (starting from the root folder) of the files (I mean only the leaves = files, not folders). How can I do this?
Share
Using standard Java SE classes and recursion you could do it this way:
Note, instead of
System.out.println()you’d probably want to put the path to someArrayList.