Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table plus
applyColStyleToCelltrue
heading0
columnTypess,s,s,s
multiplefalse
columnAttributesstyle="background:#e5e7ea;font-weight:bold,,style="background:#e5e7ea;font-weight:bold,
enableSortingfalse

Syntax

fileInfo(path)

Package

file

Alias

Pkg Usage

info(path)

Description

Excerpt
hiddentrue

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
applyColStyleToCelltrue
columnTypess,s,s,s
heading0
multiplefalse
enableSortingfalse

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
languagejs
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"]);
js
Code Block
language
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
languagejs
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)
showLabelsfalse
max25
showSpacefalse
cqllabel = "file_routine" and space = currentSpace ( )
labelsarray_routines