Table plus |
---|
applyColStyleToCell | true |
---|
heading | 0 |
---|
columnTypes | s,s,s,s |
---|
multiple | false |
---|
columnAttributes | style="background:#e5e7ea;font-weight:bold,,style="background:#e5e7ea;font-weight:bold, |
---|
enableSorting | false |
---|
|
Syntax | fileInfo(path) | Package | file | Alias | | Pkg Usage | info(path) |
|
Description
Excerpt |
---|
|
Returns basic file information about a file such as the date it was created. |
Returns basic file information about a file such as the date it was created.
...
Table plus |
---|
applyColStyleToCell | true |
---|
columnTypes | s,s,s,s |
---|
heading | 0 |
---|
multiple | false |
---|
enableSorting | false |
---|
|
Parameter name | Type | Required | Description |
---|
path | String | Yes | File path to the file to get the information for. |
|
Return Type
String []
Returns an array containing the information about the file.
Examples
Example 1
Code Block |
---|
|
string [] file = fileInfo("someFile.xlsx");
runnerLog("Path: " + file["absolutePath"]);
runnerLog("Created Date: " + parseDate("yyyy-MM-dd hh:mm:ss", file["created"]));
runnerLog("Created Date Long: " + formatNumber(file["createdLong"], "#####"));
runnerLog("Last Modified Date: " + parseDate("yyyy-MM-dd hh:mm:ss", file["lastModified"]));
runnerLog("Last Modified Long: " + formatNumber(file["lastModifiedLong"], "#####"));
runnerLog("URI: " + file["uri"]);
runnerLog("Directory: " + file["isDirectory"]);
runnerLog("Symbolic Link: " + file["isSymbolic"]);
runnerLog("Parent Folder: " + file["parent"]);
runnerLog("Readable: " + file["canRead"]);
runnerLog("Writable: " + file["canWrite"]);
runnerLog("Executable: : " + file["canExecute"]); |
Code Block |
---|
language | js |
---|
Path: C:\Program Files\Atlassian\Application Data\JIRA_versions\silprograms\someFile.xlsx
Created Date: 2020-10-13 13:05:49
Created Date Long: 1602608749593
Last Modified Date: 2020-10-13 13:07:50
Last Modified Long: 1602608870213
URI: /C:/Program Files/Atlassian/Application Data/JIRA_versions/silprograms/someFile.xlsx
Directory: false
Symbolic Link: false
Parent Folder: C:\Program Files\Atlassian\Application Data\JIRA_versions\silprograms
Readable: true
Writable: true
Executable: true |
...
Get all the attachments for an issue that were created during the current day. Assume the issue has the following attachments: Apple.jpg - created 2 weeks ago Banana.jpg - 1 hour ago Orange.jpg - created 1 week ago Strawberry.jpg - 4 hours ago
Code Block |
---|
|
string [] attachmentsCreatedToday;
for(string a in attachments) {
string [] file = fileInfo(getAttachmentPath(key, a));
date created = parseDate("yyyy-MM-dd hh:mm:ss", file["created"]);
if(created > startOfDay(currentDate())) {
attachmentsCreatedToday += a;
}
}
return attachmentsCreatedToday; |
Results: Banana.jpg|Strawberry.jpg
Note |
---|
1. It is recommended that you use forward slashes ( / ) for file paths. 2. If the file path contains a backslash replace it with two backslashes, otherwise you will get a syntax error. |
See also
Filter by label (Content by label) |
---|
showLabels | false |
---|
max | 25 |
---|
showSpace | false |
---|
cql | label = "file_routine" and space = currentSpace ( ) |
---|
labels | array_routines |
---|
|