forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfolders.lcdoc
More file actions
131 lines (96 loc) · 4.41 KB
/
folders.lcdoc
File metadata and controls
131 lines (96 loc) · 4.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
Name: folders
Type: function
Syntax: the [{ detailed | long }] folders
Syntax: folders([<targetFolder>[, <outputKind>]])
Summary:
List the subfolders in a folder.
Introduced: 1.0
OS: mac, windows, linux, ios, android, html5
Platforms: desktop, server, mobile
Security: disk
Example:
put folders(specialFolderPath("documents")) into \
field "Available Folders"
filter lines of field "Available Folders" without ".."
sort lines of field "Available Folders" international
Example:
local tDiskContents
put the files & return & the folders into \
tDiskContents["the defaultFolder"]
filter tDiskContents["the defaultFolder"] without ".."
Parameters:
targetFolder (String):
The folder path to search.
outputKind (enum):
- empty: Use the short form
- "detailed": Use the long/detailed form
Returns (String):
A list of folder names or folder information, with
one file per line.
Description:
<Return(glossary)> a list of <folder(glossary)|folders> in the
<targetFolder>, with one file per line. If no <targetFolder> is
specified, list the files in the <current folder>.
The list only includes folders at the top level of the <targetFolder>.
The <folders> <function> does not recursively enter and examine
folders deeper in the filesystem. To examine the contents of a
<subfolder|subfolders>, either pass its path as the <targetFolder>, or
temporarily set the <defaultFolder>.
<file(glossary)|Files> are not included in the list. To get a list of
files, use the <files> function.
<alias|Aliases> (on OS X systems), <symbolic links|symbolic links> (on
Linux systems) and <shortcut|shortcuts> (on Windows systems) are
included in the list only if they refer to a <folder>.
> *Important:* The list returned by the <folders> contain a ".." entry
> representing the link to the parent folder. Care must be taken to
> filter this entry out to prevent infinite loops and security
> vulnerabilities.
> *Note:* The order that folders are listed is platform-dependent.
> The order may vary between <platform|platforms>, between
> filesystems, and even between consecutive calls to the <folders>
> function. If you need a sorted list, use the <sort> command.
### Short form
When the <folders> is called as a <function>, or without the `long` or
`detailed` modifiers, it <return(glossary)|returns> only the <folder>
names as a string with one file name per line.
> *Note:* On some <platform|platforms>, folder names are permitted to
> include the <return(constant)|linefeed> character. Such a folder
> name would be split across more than one line of the string returned
> by the <folders> <function>.
### Long form
`the long folders` and `the detailed folders` are synonyms. When
the <folders> <function> is called in this form, the <return(glossary)>
value is a list of folders with detailed file attributes. Several of
the attributes are provided only for compatibility with the <files>
<function> and do not have any meaning for a <folder>.
Each line in the return value is a comma-separated list of file
attributes, as follows:
1. **Name**. The folder name is URL-encoded. To obtain the name as
plain text, use the <URLDecode> function.
2. **Size**, in bytes. This is always 0.
3. **Resource fork size**, in bytes. This is always 0.
4. **Creation date**, in seconds. (OS X and Windows only).
5. **Last modification date**, in seconds.
6. **Last access date**, in seconds.
7. **Last backup date**, in seconds.
8. **User owner**. (Linux and OS X only).
9. **Group owner**. (Linux and OS X only).
10. **Permissions**. (Linux and OS X only; see note).
11. **Creator and <fileType|file type>**. (OS X only).
Any attribute that is not relevant to the current <platform> is left
empty.
The access permissions consist of three octal digits, in the same form
used for the <umask> property.
> *Note:* On Windows, the permissions are always reported as "777".
The creator and file type are always "????????".
Changes:
The <long> form was introduced in version 1.1.
The optional <targetFolder> argument for the function call form was
introduced in version 8.1.
References: sort (command), return (constant), folders (function),
specialFolderPath (function), alias (glossary), current folder (glossary),
data fork (glossary), folder (glossary), function (glossary),
platform (glossary), return (glossary), resource fork (glossary),
shortcut (glossary), subfolder (glossary), symbolic link (glossary),
defaultFolder (property), umask (property), long (keyword)
Tags: file system