<doc>
	<legacy_id>2313</legacy_id>
	<name>files</name>
	<type>function</type>

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

	<synonyms>
	</synonyms>

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

	<examples>
		<example>put the files into field &quot;Current Files&quot;</example>
		<example>repeat with x = 1 to the number of lines of the detailed files</example>
		<example>put the files &amp; the folders into diskContents[the defaultFolder]</example>
	</examples>

	<history>
		<introduced version="1.0">Added. </introduced>
		<deprecated version=""></deprecated>
		<removed version=""></removed>
		<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="answer file">answer file Command</command>
		<property tag="umask">umask Property</property>
		<property tag="fileType">fileType Property</property>
	</references>

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

	<parameters></parameters>

	<value>The <b>files</b> <control_st tag="function">function</control_st> returns a list of file names, one per <keyword tag="line">line</keyword>. </p><p></p><p>The detailed files form returns a list of files, one file per line. Each line contains the following attributes, separated by commas:</p><p>&#9;* The file's name, URL-encoded</p><p>&#9;* The file's size in bytes (on Mac OS and OS X systems, the size of the file's data fork)</p><p>&#9;* The resource fork size in bytes (Mac OS and OS X systems only)</p><p>&#9;* The file's creation date in seconds (Mac OS, OS X, and Windows systems only)</p><p>&#9;* The file's modification date in seconds</p><p>&#9;* The file's last-accessed date in seconds (Unix, OS X and Windows systems only)</p><p>&#9;* The file's last-backup date in seconds (Mac OS and OS X systems only)</p><p>&#9;* The file's owner (Unix and OS X systems only)</p><p>&#9;* The file's group owner (Unix and OS X systems only)</p><p>&#9;* The file's access permissions</p><p>&#9;* The file's creator and file type (Mac OS and OS X only)</p><p>Any attribute that is not supported on the current system is reported as empty.</value>
	<comments>Folders in the <b>defaultFolder</b> are not included. To get a list of folders, use the <function tag="folders">folders</function> function.<p></p><p>The names of aliases (on Mac OS and OS X systems), symbolic links (on Unix systems), and shortcuts (on Windows systems) are included in the value returned by the <b>files</b> if they refer to a <keyword tag="file">file</keyword>.  If they refer to a <property tag="defaultFolder">folder</property>, they are not included. </p><p></p><p>The forms the detailed files and the long files are synonyms. </p><p></p><p>When listed in the detailed files form, each file's name is URL-encoded.  To obtain the name in plain text, use the <function tag="urldecode">URLDecode</function> function. If the detailed modifier is not used, the filename is not encoded. </p><p></p><p>The access permissions returned in the detailed files form consist of three octal digits. The form is the same as that used for the <property tag="umask">umask</property> property.</p><p></p><p>The creator and file type returned in the detailed files form is an eight-character string. The first four characters are the creator signature, and the last four are the file type. </p>
<p></p>
<p><note>For efficiency reasons, the <b>files</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 <command tag="sort">sort</command> command explicitly afterwards.</note></p>
<p></p>
<p><b>Changes:</b></p>
<p>The detailed files form was introduced in version 1.1. In previous versions, the <b>files</b> function provided only a list of file names.</p>
</comments>
	</description>
</doc>