I’m trying to take a directory and list its contents in a string array so that a while loop can loop through the contents to find the .out files I’m reading. My program currently can read one of the .out files if given the specific file directory.
Problem is that I need it to be able to find the parent folder of the other folders so that it can then loop through each child folder, get the .out file, find and write the information needed then move onto the next child folder.
The only trouble I’m having is converting the string directory into a format that the .list() method can read. Any ideas?
I don’t know what a “string directory” is, but have you tried this:
You might also consider using
listFiles()instead oflist(), but then you’ll need to extract each file name. It’s six of one, half a dozen of the other.