I have been working on this String Split method and the special for loop that I am currently trying to get to properly work does not seem to be working no matter what I do. It keeps printing just the parent directory and not the lower directories.

 public boolean moveDown(String file) {
    String[] input = file.split("\\\\"); // breaks string into individual file names
    ArrayList<Node> children = current.getChildren();
    for (Node c : children) {
        if (file.equals(c.getName())) {
            current = c;
            location += "\\" + current.getName();
            return true;
            if(file.equals(c.getName(file.split()))){
                current = c;
                location+= "\\" + current.getName();
                return true;
            }
        }

    }
    return false;
}

That fragment of code makes no sense withoutall the other code that you didn't post here, so it's impossible to understand. You have shared variables, classes, and parameters that we know nothing about, and a method that seems to be all about its side effects.
In particular line 9 looks weird. How does getName handle a parameter that's an array of Strings?

String[] input = file.split("\\\\")

have you checked the result of this, the size of input?
might be it "splits" to one element, being the original String.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.