<h2>org.autoplot.datasource.FileSystemUtil</h2><p>More abstract filesystem functions.</p>
<h2>FileSystemUtil( )</h2>
<p></p>

<hr>
<a name="copyFile"></a>
<h2>copyFile</h2>
copyFile( <a href='https://docs.oracle.com/javase/8/docs/api/java/io/File.html'>java.io.File</a> partFile, <a href='https://docs.oracle.com/javase/8/docs/api/java/io/File.html'>java.io.File</a> targetFile ) &rarr; boolean

<p>copy the file to a new name.</p>

<h3>Parameters</h3>
partFile - a File
<br>
targetFile - a File

<h3>Returns:</h3>
a boolean

<br><br>
<a href="https://github.com/autoplot/dev/search?q=copyFile&unscoped_q=copyFile">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/datasource/FileSystemUtil.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/datasource/FileSystemUtil.html#copyFile">[view on old javadoc]</a>
 <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/DataSource/src/org/autoplot/datasource/FileSystemUtil.java#l286">[view source]</a>
<br>
<br>
<hr>
<a name="deleteFilesInTree"></a>
<h2>deleteFilesInTree</h2>
deleteFilesInTree( <a href='https://docs.oracle.com/javase/8/docs/api/java/io/File.html'>java.io.File</a> root, <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/autoplot/datasource/FileSystemUtil/Check.html'>org.autoplot.datasource.FileSystemUtil.Check</a> shouldDelete ) &rarr; boolean

<p>deletes all files where shouldDelete returns true and empty 
 folders below root, and root.  If a directory is left empty, then it is also deleted.</p>

<h3>Parameters</h3>
root - the root of the tree to start searching.  If root does not exist, return true!
<br>
shouldDelete - an object which returns true if the file should be deleted, or if null is used, then any file is deleted.

<h3>Returns:</h3>
true if the operation was successful.
<h3>See Also:</h3>
<a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/das2/util/filesystem/FileSystemUtil.html#deleteAllFiles'>org.das2.util.filesystem.FileSystemUtil#deleteAllFiles(java.io.File, java.lang.String)</a> <br>
<br><br>
<a href="https://github.com/autoplot/dev/search?q=deleteFilesInTree&unscoped_q=deleteFilesInTree">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/datasource/FileSystemUtil.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/datasource/FileSystemUtil.html#deleteFilesInTree">[view on old javadoc]</a>
 <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/DataSource/src/org/autoplot/datasource/FileSystemUtil.java#l246">[view source]</a>
<br>
<br>
<hr>
<a name="doDownload"></a>
<h2><del>doDownload</del></h2>
Deprecated: use DataSetURI.getFile instead
<hr>
<a name="getNameRelativeTo"></a>
<h2>getNameRelativeTo</h2>
getNameRelativeTo( <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/org/das2/util/filesystem/FileSystem.html'>org.das2.util.filesystem.FileSystem</a> fs, <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> resource ) &rarr; <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a>

<p></p>

<h3>Parameters</h3>
fs - a FileSystem
<br>
resource - a String

<h3>Returns:</h3>
java.lang.String

<br><br>
<a href="https://github.com/autoplot/dev/search?q=getNameRelativeTo&unscoped_q=getNameRelativeTo">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/datasource/FileSystemUtil.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/datasource/FileSystemUtil.html#getNameRelativeTo">[view on old javadoc]</a>
 <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/DataSource/src/org/autoplot/datasource/FileSystemUtil.java#l49">[view source]</a>
<br>
<br>
<hr>
<a name="getPresentWorkingDirectory"></a>
<h2>getPresentWorkingDirectory</h2>
getPresentWorkingDirectory(  ) &rarr; <a href='https://docs.oracle.com/javase/8/docs/api/java/io/File.html'>java.io.File</a>

<p>get the current working directory (pwd)</p>

<h3>Returns:</h3>
the current working directory.
<br><br>
<a href="https://github.com/autoplot/dev/search?q=getPresentWorkingDirectory&unscoped_q=getPresentWorkingDirectory">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/datasource/FileSystemUtil.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/datasource/FileSystemUtil.html#getPresentWorkingDirectory">[view on old javadoc]</a>
 <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/DataSource/src/org/autoplot/datasource/FileSystemUtil.java#l71">[view source]</a>
<br>
<br>
<hr>
<a name="hasParent"></a>
<h2>hasParent</h2>
hasParent( <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URL.html'>java.net.URL</a> url ) &rarr; boolean

<p>return true if the file has a parent which is resolvable.</p>

<h3>Parameters</h3>
url - an URL

<h3>Returns:</h3>
<pre>
 {@code
 from org.autoplot.datasource import FileSystemUtil
 print FileSystemUtil.hasParent(URL('http://autoplot.org/data/2016/ace_mag_2016_001.cdf'))  # True
 print FileSystemUtil.hasParent(URL('http://autoplot.org/Image:tabs.png'))  # False
 }
 </pre>
<br><br>
<a href="https://github.com/autoplot/dev/search?q=hasParent&unscoped_q=hasParent">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/datasource/FileSystemUtil.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/datasource/FileSystemUtil.html#hasParent">[view on old javadoc]</a>
 <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/DataSource/src/org/autoplot/datasource/FileSystemUtil.java#l202">[view source]</a>
<br>
<br>
<hr>
<a name="isChildOf"></a>
<h2>isChildOf</h2>
isChildOf( <a href='https://docs.oracle.com/javase/8/docs/api/java/io/File.html'>java.io.File</a> possibleParent, <a href='https://docs.oracle.com/javase/8/docs/api/java/io/File.html'>java.io.File</a> maybeChild ) &rarr; boolean

<p>return true if the possibleParent is a valid folder tree root, and maybeChild exists within tree.</p>

<h3>Parameters</h3>
possibleParent - parent file.
<br>
maybeChild - a file or folder which may exist within possibleParent.

<h3>Returns:</h3>
true if possibleParent is a folder containing
<br><br>
<a href="https://github.com/autoplot/dev/search?q=isChildOf&unscoped_q=isChildOf">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/datasource/FileSystemUtil.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/datasource/FileSystemUtil.html#isChildOf">[view on old javadoc]</a>
 <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/DataSource/src/org/autoplot/datasource/FileSystemUtil.java#l62">[view source]</a>
<br>
<br>
<hr>
<a name="isLocalResource"></a>
<h2>isLocalResource</h2>
isLocalResource( <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> file ) &rarr; boolean

<p>return true if the resource is local, and can therefore be trusted.  
 This was introduced to secure the server, where an Autoplot there could be 
 used to access local resources.  This returns true for file:/ references.
 Note this will also return true for sftp since the reference 
 may utilize keys private to the server.  Note too that a .jyds script
 that is not local could attempt to use local resources.  For this reason
 there is JythonDataSourceFactory.hasLocalReferences.
 
 "upload" is another magic element.  Paths containing "upload" are considered 
 remote.  This is to allow areas where content is uploaded.</p>

<h3>Parameters</h3>
file - an Autoplot URI.

<h3>Returns:</h3>
true if the uri is a reference to a local resource.
<br><br>
<a href="https://github.com/autoplot/dev/search?q=isLocalResource&unscoped_q=isLocalResource">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/datasource/FileSystemUtil.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/datasource/FileSystemUtil.html#isLocalResource">[view on old javadoc]</a>
 <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/DataSource/src/org/autoplot/datasource/FileSystemUtil.java#l168">[view source]</a>
<br>
<br>
<hr>
<a name="resourceExists"></a>
<h2>resourceExists</h2>
resourceExists( <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> suri ) &rarr; boolean

<p>checks to see if the resource uri appears to represent an existing
 data source.  false indicates that the resource is known to not exist.
 true indicates that the resource does exist.</p>

<h3>Parameters</h3>
suri - URI, such as http://server.org/data/asciitable.dat

<h3>Returns:</h3>
true of the resource exists and can be downloaded.
<br><br>
<a href="https://github.com/autoplot/dev/search?q=resourceExists&unscoped_q=resourceExists">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/datasource/FileSystemUtil.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/datasource/FileSystemUtil.html#resourceExists">[view on old javadoc]</a>
 <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/DataSource/src/org/autoplot/datasource/FileSystemUtil.java#l95">[view source]</a>
<br>
<br>
<hr>
<a name="resourceIsLocal"></a>
<h2>resourceIsLocal</h2>
resourceIsLocal( <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> suri ) &rarr; boolean

<p>returns true if the resource is already in a local cache.</p>

<h3>Parameters</h3>
suri - the URI containing a file resource.

<h3>Returns:</h3>
true if the resource is already in a local cache.
<br><br>
<a href="https://github.com/autoplot/dev/search?q=resourceIsLocal&unscoped_q=resourceIsLocal">[search for examples]</a>
 <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/datasource/FileSystemUtil.md">[view on GitHub]</a>
 <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/autoplot/datasource/FileSystemUtil.html#resourceIsLocal">[view on old javadoc]</a>
 <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/DataSource/src/org/autoplot/datasource/FileSystemUtil.java#l132">[view source]</a>
<br>
<br>