Note that there are some explanatory texts on larger screens.

plurals
  1. POjava language. it says my file doesn't exist but it does
    primarykey
    data
    text
    <pre><code>private void traverse(String dir, int ctr) throws IOException { // get current file and name File myFile = new File(dir); System.out.println("dir path: " + myFile.getAbsolutePath()); // correct path System.out.println("exists? : " + myFile.exists()); // returns false String name = myFile.getName(); System.out.println(dir + " is dir? " + myFile.isDirectory()); if (name.equals("tree.txt")) return; // print tabs and name for (int i = 0; i &lt; ctr; ++i) bw2.write("\t"); bw2.write(name); bw2.newLine(); if (myFile.isFile() &amp;&amp; name.charAt(0) != '.') { File f = new File(dir + "." + name); int version = 1; // if doesn't exist then version is 1 if (f.exists()) { FileInputStream fis = new FileInputStream(f); InputStreamReader isr = new InputStreamReader(fis); BufferedReader br = new BufferedReader(isr); version = Integer.parseInt(br.readLine()); // get version br.close(); } fos1 = new FileOutputStream(f); osw1 = new OutputStreamWriter(fos1); bw1 = new BufferedWriter(osw1); bw1.write(version); // write version bw1.close(); } else if (myFile.isDirectory()) { String dirContents[] = myFile.list(); for (String content : dirContents) { traverse(dir + content + '/', ctr + 1); } } } // end traverse </code></pre> <p>output:</p> <pre><code>kedy@Laptop:~/Desktop/connection$ java Server dir path: /home/kedy/Desktop/connection/test.txt exists? : false test.txt/ is dir? false dir path: /home/kedy/Desktop/connection/tree.txt exists? : false tree.txt/ is dir? false dir path: /home/kedy/Desktop/connection/folder 2 exists? : false folder 2/ is dir? false dir path: /home/kedy/Desktop/connection/test2.txt exists? : false test2.txt/ is dir? false dir path: /home/kedy/Desktop/connection/folder exists? : false folder/ is dir? false </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload