EXPRESSIONS

You get either a real file, if there is one, or an abstract file that can then be created.

[the] (file[s]|dir[ector(y|ies)]) [path] %strings%
set {_file} to file "eula.txt"

Get an absolute path

Absolute means the path starts from the root of the file system.

absolute path of %path%
%path%'s absolute path
set {_file} to absolute path of file "eula.txt"

Get all files inside a directory

You can do this recursively, getting files in the directory and all internal directories.

[all] files in %path%
loop all files in dir "plugins/":
  broadcast "%loop-value%"

Get the text content of a file

Can be changed.

content[s] of %path%
%path%'s content[s]
set {_file} to content of file "eula.txt"
replace all "false" with "true" in {_file}
set content of file "eula.txt" to {_file}

Get the name of a file or directory

Can be changed.

name of %path%
%path%'s name
loop all files in dir "plugins/":
  broadcast name of file loop-value

Read a line or lines of a file, or change them

[the] line %number% (from|of|in) %path%
[all] [the] lines (from|of|in) %path%
set line 1 of file "eula.txt" to "eula=true"

Get the directory where the file or folder is located

Can be changed.

parent of %path%
%path%'s parent
set {_file} to parent of file "eula.txt"

Get file size in bytes

size of %path%
%path%'s size

Get the last access date of a file

last access time of %path%
%path%'s last access time

Get the last modified date of a file

last modified time of %path%
%path%'s last modified time

Get file creation date

creation time of %path%
%path%'s creation time

Get file extension

extension of %path%
%path%'s extension

Disk space info

total space of %path%
usable space of %path%