Child pages
  • JSFile

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Rev: 1381948887907

...

HTML Table
id
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
tbody
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#canReadcanRead()
Returns true if the file exists and is readable (has access to it) - works on remote files too.
tbody
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#canWritecanWrite()
Returns true if the file exists and can be modified - works on remote files too.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#createNewFilecreateNewFile()
Creates the file on disk if needed.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#deleteFiledeleteFile()
Deletes the file from the disk if possible.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#existsexists()
Returns true if the file/directory exists on the filesystem - works on remote files too.
tbody
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSFile
Table Cell (td)
#getAbsoluteFilegetAbsoluteFile()
Returns a JSFile instance that corresponds to the absolute form of this pathname - works on remote files too.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getAbsolutePathgetAbsolutePath()
Returns a String representation of the absolute form of this pathname - works on remote files too.
tbody
Table Body (tbody)
Table Row (tr)
Table Cell (td)
byte[]
Table Cell (td)
#getBytesgetBytes()
Gets the contents (bytes) for the file data.
tbody
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getContentTypegetContentType()
Returns the contenttype of this file, like for example 'application/pdf' - works on remote files too.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getNamegetName()
Returns the name of the file.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getParentgetParent()
Returns the String representation of the path of the parent of this file - works on remote files too.
tbody
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSFile
Table Cell (td)
#getParentFilegetParentFile()
Returns a JSFile instance that corresponds to the parent of this file - works on remote files too.
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getPathgetPath()
Returns a String holding the path to the file - works on remote files too.
tbody
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#isAbsoluteisAbsolute()
Returns true if the path is absolute.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#isDirectoryisDirectory()
Returns true if the file is a directory - works on remote files too.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#isFileisFile()
Returns true if the file is a file and not a regular file - works on remote files too.
tbody
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#isHiddenisHidden()
Returns true if the file is hidden (a file system attribute) - works on remote files too.
Table Row (tr)
Table Cell (td)
Date
Table Cell (td)
#lastModifiedlastModified()
Returns the time/date of the last modification on the file - works on remote files too.
tbody
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String[]
Table Cell (td)
#listlist()
Returns an array of strings naming the files and directories located inside the file, if the file is a directory - works on remote files too.
tbody
Table Row (tr)
Table Cell (td)
JSFile[]
Table Cell (td)
#listFileslistFiles()
Returns an array of JSFiles naming the files and directories located inside the file, if the file is a directory - works on remote files too.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#mkdirmkdir()
Creates a directory on disk if possible.
tbody
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#mkdirsmkdirs()
Creates a directory on disk, together with all its parent directories, if possible.
tbody
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#renameTorenameTo(destination)
Renames the file to a different name.
tbody
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#setBytessetBytes(bytes)
Set the content of the file (local or remote) to the bytes provided<br/>
Will not create a new file if one doesn't exist
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#setBytessetBytes(bytes, createFile)
Set the content of the file (local or remote) to the bytes provided
tbody
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#setLastModifiedsetLastModified(date)
Sets the date/time of the last modification on the file.
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#setReadOnlysetReadOnly()
Sets the readonly attribute of the file/directory.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#sizesize()
Returns the size in bytes of the file.

HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Method Details
Table Body (tbody)
idcanRead
Table Row (tr)
idname
Table Cell (td)
canRead
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
canRead
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the file exists and is readable (has access to it) - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idcanWrite
Table Row (tr)
idname
Table Cell (td)
canWrite
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
canWrite
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the file exists and can be modified - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idcreateNewFile
Table Row (tr)
idname
Table Cell (td)
createNewFile
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
createNewFile
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Creates the file on disk if needed. Returns true if the file (name) did not already exists and had to be created - for remote, use the streamFilesToServer to stream a file.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('story.txt');
if (!f.exists())
	f.createNewFile();

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
iddeleteFile
Table Row (tr)
idname
Table Cell (td)
deleteFile
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
deleteFile
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Deletes the file from the disk if possible. Returns true if the file could be deleted. If the file is a directory, then it must be empty in order to be deleted - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('story.txt');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/story.txt');
if (f && f.exists())
	f.deleteFile();

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idexists
Table Row (tr)
idname
Table Cell (td)
exists
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
exists
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the file/directory exists on the filesystem - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetAbsoluteFile
Table Row (tr)
idname
Table Cell (td)
getAbsoluteFile
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSFile
Span
stylefont-weight: bold;
getAbsoluteFile
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns a JSFile instance that corresponds to the absolute form of this pathname - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
JSFile
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('story.txt');
// or for a remote file:
// var f = plugins.file.convertToRemoteJSFile('/story.txt');
application.output('parent folder: ' + f.getAbsoluteFile().getParent());
application.output('parent folder has ' + f.getAbsoluteFile().getParentFile().listFiles().length + ' entries');

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetAbsolutePath
Table Row (tr)
idname
Table Cell (td)
getAbsolutePath
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getAbsolutePath
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns a String representation of the absolute form of this pathname - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetBytes
Table Row (tr)
idname
Table Cell (td)
getBytes
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
byte[]
Span
stylefont-weight: bold;
getBytes
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Gets the contents (bytes) for the file data.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
byte[]
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var theFile = plugins.file.showFileOpenDialog();
application.output('The file size in bytes: ' + theFile.getBytes());

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetContentType
Table Row (tr)
idname
Table Cell (td)
getContentType
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getContentType
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the contenttype of this file, like for example 'application/pdf' - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetName
Table Row (tr)
idname
Table Cell (td)
getName
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getName
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the name of the file. The name consists in the last part of the file path - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetParent
Table Row (tr)
idname
Table Cell (td)
getParent
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getParent
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the String representation of the path of the parent of this file - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('story.txt');
// or for a remote file:
// var f = plugins.file.convertToRemoteJSFile('/story.txt');
application.output('parent folder: ' + f.getAbsoluteFile().getParent());
application.output('parent folder has ' + f.getAbsoluteFile().getParentFile().listFiles().length + ' entries');

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetParentFile
Table Row (tr)
idname
Table Cell (td)
getParentFile
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSFile
Span
stylefont-weight: bold;
getParentFile
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns a JSFile instance that corresponds to the parent of this file - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
JSFile
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('story.txt');
// or for a remote file:
// var f = plugins.file.convertToRemoteJSFile('/story.txt');
application.output('parent folder: ' + f.getAbsoluteFile().getParent());
application.output('parent folder has ' + f.getAbsoluteFile().getParentFile().listFiles().length + ' entries');

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetPath
Table Row (tr)
idname
Table Cell (td)
getPath
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getPath
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns a String holding the path to the file - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idisAbsolute
Table Row (tr)
idname
Table Cell (td)
isAbsolute
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
isAbsolute
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the path is absolute. The path is absolute if it starts with '/' on Unix/Linux/MacOS or has a driver letter on Windows - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idisDirectory
Table Row (tr)
idname
Table Cell (td)
isDirectory
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
isDirectory
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the file is a directory - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idisFile
Table Row (tr)
idname
Table Cell (td)
isFile
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
isFile
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the file is a file and not a regular file - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idisHidden
Table Row (tr)
idname
Table Cell (td)
isHidden
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
isHidden
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns true if the file is hidden (a file system attribute) - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idlastModified
Table Row (tr)
idname
Table Cell (td)
lastModified
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Date
Span
stylefont-weight: bold;
lastModified
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the time/date of the last modification on the file - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Date
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idlist
Table Row (tr)
idname
Table Cell (td)
list
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String[]
Span
stylefont-weight: bold;
list
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns an array of strings naming the files and directories located inside the file, if the file is a directory - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
String[]
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var d = plugins.file.convertToJSFile('plugins');
// or for a remote file:
// var d = plugins.convertToRemoteJSFile('/plugins');
var names = d.list();
application.output('Names:');
for (var i=0; i<names.length; i++)
	application.output(names[i]);
var files = d.listFiles();
application.output('Absolute paths:');
for (var i=0; i<files.length; i++)
	application.output(files[i].getAbsolutePath());

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idlistFiles
Table Row (tr)
idname
Table Cell (td)
listFiles
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSFile[]
Span
stylefont-weight: bold;
listFiles
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns an array of JSFiles naming the files and directories located inside the file, if the file is a directory - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
JSFile[]
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var d = plugins.file.convertToJSFile('plugins');
// or for a remote file:
// var d = plugins.convertToRemoteJSFile('/plugins');
var names = d.list();
application.output('Names:');
for (var i=0; i<names.length; i++)
	application.output(names[i]);
var files = d.listFiles();
application.output('Absolute paths:');
for (var i=0; i<files.length; i++)
	application.output(files[i].getAbsolutePath());

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idmkdir
Table Row (tr)
idname
Table Cell (td)
mkdir
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
mkdir
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Creates a directory on disk if possible. Returns true if a new directory was created - for remote, use the streamFilesToServer to create the directory instead.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('one/two/three/four');
f.mkdirs(); // Create all four levels of folders in one step.
var g = plugins.file.convertToJSFile('one/two/three/four/five');
g.mkdir(); // This will work because all parent folders are already created.

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idmkdirs
Table Row (tr)
idname
Table Cell (td)
mkdirs
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
mkdirs
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Creates a directory on disk, together with all its parent directories, if possible. Returns true if the hierarchy of directories is created - for remote, use the streamFilesToServer to create the directories instead.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('one/two/three/four');
f.mkdirs(); // Create all four levels of folders in one step.
var g = plugins.file.convertToJSFile('one/two/three/four/five');
g.mkdir(); // This will work because all parent folders are already created.

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idrenameTo-Object
Table Row (tr)
idname
Table Cell (td)
renameTo
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
renameTo
Span
(destination)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Renames the file to a different name. Returns true if the file could be renamed - works on remote files too.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{Object} destination
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('story.txt');
f.renameTo('otherstory.txt');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/story.txt');
// f.renameTo('/otherstory.txt');

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetBytes-byteArray
Table Row (tr)
idname
Table Cell (td)
setBytes
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
setBytes
Span
(bytes)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Set the content of the file (local or remote) to the bytes provided<br/>
Will not create a new file if one doesn't exist
Table Row (tr)
idsnc
Table Cell (td)
Since
Div
classsIndent
5.2.5
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{byte[]} bytes

...

- the data
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean

...

- true if the operation worked
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var file = plugins.file.convertToJSFile('/pathTo/file.jpg');
// or for a remote file:
// var file = plugins.file.convertToRemoteJSFile('/remotePathTo/file.jpg');
var success = file.setBytes(blobDataProvider, true);

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetBytes-byteArray_Boolean
Table Row (tr)
idname
Table Cell (td)
setBytes
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
setBytes
Span
(bytes, createFile)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Set the content of the file (local or remote) to the bytes provided
Table Row (tr)
idsnc
Table Cell (td)
Since
Div
classsIndent
5.2.5
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{byte[]} bytes

...

- the data
{Boolean} createFile

...

- true to create a file if it doesn't exist
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean

...

- true if the operation worked
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var file = plugins.file.convertToJSFile('/pathTo/file.jpg');
// or for a remote file:
// var file = plugins.file.convertToRemoteJSFile('/remotePathTo/file.jpg');
var success = file.setBytes(blobDataProvider, true);

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetLastModified-Object
Table Row (tr)
idname
Table Cell (td)
setLastModified
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
setLastModified
Span
(date)
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Sets the date/time of the last modification on the file.
Table Row (tr)
idprs
Table Cell (td)
Parameters
Div
classsIndent
{Object} date
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('story.txt');
f.createNewFile();
// Make the file look old.
f.setLastModified(new Date(1999, 5, 21));

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetReadOnly
Table Row (tr)
idname
Table Cell (td)
setReadOnly
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
setReadOnly
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Sets the readonly attribute of the file/directory. Returns true on success.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('invoice.txt');
plugins.file.writeTXTFile(f, 'important data that should not be changed');
f.setReadOnly();

...

Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsize
Table Row (tr)
idname
Table Cell (td)
size
Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Number
Span
stylefont-weight: bold;
size
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the size in bytes of the file. Returns 0 if the file does not exist on disk - works on remote files too.
Table Row (tr)
idret
Table Cell (td)
Returns
Div
classsIndent
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript

...

var f = plugins.file.convertToJSFile('./big.jpg');
// or for a remote file:
// var f = plugins.convertToRemoteJSFile('/images/big.jpg');
if (f && f.exists()) {
	application.output('is absolute: ' + f.isAbsolute());
	application.output('is dir: ' + f.isDirectory());
	application.output('is file: ' + f.isFile());
	application.output('is hidden: ' + f.isHidden());
	application.output('can read: ' + f.canRead());
	application.output('can write: ' + f.canWrite());
	application.output('last modified: ' + f.lastModified());
	application.output('name: ' + f.getName());
	application.output('path: ' + f.getPath());
	application.output('absolute path: ' + f.getAbsolutePath());
	application.output('content type: ' + f.getContentType());
	application.output('size: ' + f.size());
}
else {
	application.output('File/folder not found.');
}

...

Table Row (tr)
classlastDetailRow
Table Cell (td)