Note that there are some explanatory texts on larger screens.

plurals
  1. PO(Java) Changed directory (via bash script) not reflected in folder.listfiles
    primarykey
    data
    text
    <p>I run a bash script from my Java program which takes a chunk of data, manipulates it, and splits it up.</p> <p>It's not a question of whether the bash script works -- I can see the split files in the directory.</p> <p>Say the original file was "bigFile" in data/</p> <p>Then</p> <pre><code> try { Process proc = Runtime.getRuntime().exec("bash " + SCRIPT_DIR + "/" + SPLIT_SCRIPT_NAME + " " + args[_MESSAGES_PER_UPLOAD_] + " " + args[_MAXIMUM_MESSAGES_PER_FEED_] + " " + (60000*Integer.parseInt(args[_DURATION_BEFORE_EACH_UPLOAD_IN_MINUTES_])/Integer.parseInt(args[_DURATION_OF_EACH_FEED_IN_MILLISECONDS_]))); proc.waitFor(); } catch(IOException e) { error(e); } String fileNames; File folder = new File(DATA_DIR); File[] filesToUpload = folder.listFiles(); for (int i = 0; i &lt; filesToUpload.length; ++i) if (filesToUpload[i].isFile()) { fileNames = filesToUpload[i].getName(); System.out.println(fileNames); } </code></pre> <p>Will print bigFile, not...</p> <p>$ ls data/</p> <p>dataChunk_00000 dataChunk_00001 dataChunk_00002 dataChunk_00003 dataChunk_00004 dataChunk_00005 dataChunk_00006 dataChunk_00007 dataChunk_00008 dataChunk_00009 dataChunk_00010 dataChunk_00011 dataChunk_00012 dataChunk_00013 dataChunk_00014 dataChunk_00015 dataChunk_00016 dataChunk_00017 dataChunk_00018 dataChunk_00019 dataChunk_00020 dataChunk_00021 dataChunk_00022 dataChunk_00023 dataChunk_00024 dataChunk_00025 dataChunk_00026 dataChunk_00027</p> <p>as it should. I'm guessing this is a compiler optimization or something.</p> <p>Edit: If somebody could explain to me why proc.waitFor() isn't working and/or a better way to solve this, I'd much appreciate it.</p>
    singulars
    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