print directory structure present in webserver
<p>I want to know the directory structure of a particular directory on the webserver. I can login through putty (by providing userid and password) but i want to do the code in java in my local system and print the directory structure for the same. I did LS -R in putty to get the same but it is very huge so i want this same to print in java console.</p>

<p>Can anyone please suggest in how to do?</p>

<p>Edit: </p>

<p>Let me explain below is the code for getting the directory structure </p>

<pre><code>static void showDir(int indent, File file) throws IOException { 

    for (int i = 0; i &lt; indent; i++) {
        System.out.print('-'); 
        System.out.println(file.getName()); 
    }
    if (file.isDirectory()) { 
        File[] files = file.listFiles(); 
        for (int i = 0; i &lt; files.length; i++){
            showDir(indent + 4, files[i]);
        } 
    }
}
</code></pre>

<p>but this prints for my local system. I want this to be work for remote server. I have the IP of server.</p>
