<doc>
	<legacy_id>1862</legacy_id>
	<name>folders</name>
	<type>function</type>

	<syntax>
		<example>the [detailed | long] folders</example>
		<example>folders()</example>
	</syntax>

	<synonyms>
		<synonym>directories</synonym>
	</synonyms>

	<summary>Returns a list of the <function tag="folders">folders</function> in the current <property tag="defaultFolder">defaultFolder</property>.</summary>

	<examples>
<example>set the defaultFolder to line x of the folders</example>
<example>put the detailed folders into folderList</example>
	</examples>

	<history>
		<introduced version="1.0">Added. </introduced>
		<deprecated version=""></deprecated>
		<removed version=""></removed>
		<changed version="4.6.1">Added Support for Android.</changed>
<changed version="4.5.2">Added Support for iOS.</changed>
<changed version="1.1">1.1</changed>
	</history>

	<objects>
	</objects>

	<platforms>
		<mac/>
		<windows/>
		<linux/>
		<ios/>
		<android/>
	</platforms>

	<classes>
		<desktop/>
		<server/>
		<web/>
		<mobile/>
	</classes>

	<security>
		<disk/>
	</security>


	<classification>
		<category>Files, Folders, &amp; Resources</category>
	</classification>

	<references>
		<function tag="volumes">volumes Function</function>
		<command tag="revDeleteFolder">revDeleteFolder Command</command>
		<property tag="umask">umask Property</property>
	</references>

	<description>
	<overview>Use the <b>folders</b> <control_st tag="function">function</control_st> to obtain a list of <function tag="folders">folders</function> to display for the user, or to perform an action on each <property tag="defaultFolder">folder</property> in the <glossary tag="current folder">current folder</glossary>.</overview>

		<parameters>
		</parameters>

	<value>The <b>folders</b> <control_st tag="function">function</control_st> returns a list of <property tag="defaultFolder">folder</property> names, one per <keyword tag="line">line</keyword>. <p></p><p>The detailed <b>folders</b> form returns a list of folders, one file per line. Each line contains the following attributes, separated by commas. (Several attributes are used only for compatibility with the <function tag="files">files</function> <control_st tag="function">function</control_st> and do not have any meaning for <function tag="folders">folders</function>.)</p><p>&#9;* The folder's name</p><p>&#9;* The folder's size in bytes (always zero)</p><p>&#9;* The folder's resource fork size in bytes (always zero)</p><p>&#9;* The folder's creation date in seconds (Mac OS, OS X, and Windows systems only)</p><p>&#9;* The folder's modification date in seconds</p><p>&#9;* The folder's last-accessed date in seconds (Unix and Windows systems only)</p><p>&#9;* The folder's last-backup date in seconds (Mac OS and OS X systems only)</p><p>&#9;* The folder's owner (Unix systems only)</p><p>&#9;* The folder's group owner (Unix systems only)</p><p>&#9;* The folder's access permissions</p><p>&#9;* The folder's creator and file type (always &quot;????????&quot;) (Mac OS and OS X only)</p><p>Any attribute that is not supported on the current system is reported as &quot;0&quot; (zero). </p></value>
	<comments>Files in the <property tag="defaultFolder">defaultFolder</property> are not included. To get a list of <b>folders</b>, use the <function tag="files">files</function> <control_st tag="function">function</control_st>. <p></p><p>The names of aliases (on Mac OS systems), symbolic links (on Unix systems), and shortcuts (on Windows systems) are included in the value returned by the <b>folders</b> if they link to a <property tag="defaultFolder">folder</property>. If they link to a <keyword tag="file">file</keyword>, they are not included. </p><p></p><p>This function lists only the folders on the top level of the <property tag="defaultFolder">defaultFolder</property>.  To get a list of <glossary tag="subfolder">subfolders</glossary> within a <property tag="defaultFolder">folder</property>, set the <property tag="defaultFolder">defaultFolder</property> to that <property tag="defaultFolder">folder</property> and then use the <b>folders</b> <control_st tag="function">function</control_st> again.</p><p></p><p>When listed in the detailed <b>folders</b> form, each folder's name is URL-encoded. To obtain the name in plain text, use the <function tag="URLDecode">URLDecode</function> <control_st tag="function">function</control_st>. If the detailed modifier is not used, the folder name is not encoded.</p><p></p><p>The access permissions returned in the detailed <function tag="files">files</function> form consist of three octal digits. The form is the same as that used for the <property tag="umask">umask</property> <glossary tag="command">command</glossary>.</p><p></p><p></p><important>The list returned by the <b>folders</b> contain a &quot;..&quot; entry representing the link to the parent folder. Care must be taken to filter this entry out when performing recursive operations to prevent infinite loops.</important><p></p><p></p><note>For efficiency reasons, the <b>folders</b> function returns a list in the order provided by the operating system which can differ between platforms and even file systems. If you require an ordered list use the sort command explicitly afterwards.</note><p></p><p></p><change><p>The detailed <b>folders</b> form was introduced in version 1.1. In previous versions, the <b>folders</b> <control_st tag="function">function</control_st> provided only a list of <property tag="defaultFolder">folder</property> names.</change></comments>
	</description>
</doc>