Note that there are some explanatory texts on larger screens.

plurals
  1. POJava I/O operating on every file in a path
    text
    copied!<p>I have an HTML help system that I need to convert to SharePoint. The two most time consuming projects are to change the document links and to gather metadata. However, I'm lucky because this data is easily accessible. Each file is an HTML document, oversimplified as below:</p> <pre><code> &lt;body&gt; &lt;!--- Metadata follows Procedure Name: my document Procedure Number: xxxxx Use: freeform text explaining when procdure is used Revision Date: xx/xx/xx By: responsible party for revision &lt;!--- end metadata &lt;h1&gt;Procedure Name&lt;\h1&gt; &lt;p&gt;procedure background and narrative, with links, as needed, to other documents at \\documentation-server\path\document-name.html &lt;\body&gt; </code></pre> <p>I can successfully extract &amp; manipulate the right Strings, and I'm trying to incorporate that process into an automated solution. Since this is my first venture into file i/o, however, I'm a little fuzzy on what to do next.</p> <p>In a perfect world, given a path, I would like to step though each *.html file in a path. I cannot seem to find a class/method to do that. <code>newInputStream</code> and <code>newOutpuStream</code> give me the file access, but I need to provide a path &amp; file parameter. The <code>FileVisitor</code> interface <em>appears</em> to only interact file attributes and perform delete/copy/rename type functions.</p> <p>Is there a soemthing that would combine these into a single function that would step through each file in a path, open it and allow my line-by-line parse, then close the file and move to the next one to repeat?</p> <p>My other thought was to create an array of filenames, then feed that array into the filename parameter of <code>newInputStream</code>.</p> <p>Suggestions? </p>
 

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