I'm having trouble asking this question, so I am trying to ask it again, only simpler. Originally asked this question on this post:http://www.experts-exchange.com/Programming/Languages/Java/Q_26920584.html
First, let me say that java isn't my strong suite. In fact, I have just pieced together enough to get myself in trouble.
Basically I have inherited some java code that searches for a specific directory in Linux in Slackware 12. I want to move the program to Slackware 13, but it has a slightly different directory structure. I have tried to tweak the code myself, but I'm not having much success. Please see the attached old code -vs- the code I have edited. I would like help in determining why it's returning null
when the directory is actually there and it's not a hidden directory.
Here is the directory structure on Slackware 12:
- the XX is some number and the '_" is a letter representing the block device id (sda, sdb, sdc, etc).
The information I want the program to retrieve is the "sd_".
Here is the directory structure on Slackware 13:
So you can see, it is slightly different. The code for Test1.java just finds the start directory, then the Test2.java searches the specific sub directories until it finds one whose name starts with "block". Then it returns the directory name back to Test1 who then picks off the last few characters to get the "sd_".
So in the edits I did, i changed the directories to search in Test2.java and added "block" as one of the criteria, and I changed the filter to startsWith("sd"). So I think Test2.java should just return the "sd_" to Test1.java and I can just output that. It seems to be searching the right directories, but it's returning null.
I would appreciate some help here. I think this will be easy for someone familiar with Java. Test1.java Test2.java NewTest1.java NewTest2.java