A newer version of Max is available. Click here to access the latest version of this document.


List the files in a specific folder


The folder object can fill a menu object with the names of files in a folder. You can specify the folder as an argument or by sending a symbol with the name in it. The forward-slash character ( / ) is used as a path delineator. An initial slash at the beginning of a path indicates the boot volume. The Max application folder is referred to by using period-slash (e.g.: "./Cycling '74/max-help"), and the Cycling '74 folder may be refered to by using C74. A path on Macintosh systems is preceded by the name of the machine and a colon:
"Macintosh HD:/Users/Documents/max stuff/Desktop/phase_vocoder.pat"
On Windows systems, a path is preceded by a drive letter
"C:/Documents/max stuff/Desktop/phase_vocoder.pat"


Name Type Opt Description
pathname symbol opt Specifies the absolute path to a folder on any mounted volume.


bang Gets the names of all files of a specific type within a specific folder, and outputs those names to be placed in a message object or a pop-up umenu object.
int input [int]
Same as bang.
anything pathname [list]
Functions the same as symbol.
symbol pathname [symbol]
Specifies the pathname of a folder in the search path, and causes the contents of that folder to be output for storage in a umenu or a message. Input pathnames can contain slashes, colons, or backslashes as separators.

A pathname looks like this:

"drive:/folder/filename.ext" (absolute pathname)

"./mypatches/steaksauce.ext" (relative pathname)

If the pathname contains any spaces, you will need to enclose the pathname in double quotes in order to cause folder to understand the pathname as a single argument. Alternatively, you can precede each space with a backslash (\) so that folder won't treat that space as a special character. The path ./ may be used to refer to the Max directory, and the path C74 represents the Cycling '74 directory.
types typecode [list]
The word types, followed by one or more four-letter type codes, sets the file types that the folder object will look for in the specified folder. Example four-letter type codes for files are TEXT for text files and AIFF for AIFF format audio files. The type fold can be used to look for folders, and an empty types message can be sent to look for all file types.

By default, the folder object looks for TEXT and maxb (Max 4 binary) files.

Information for box attributes common to all objects


append: Out left outlet: Immediately following the clear message, each filename in the specified folder is sent out in alphabetical order preceded by the word append.
clear: Out left outlet: When a pathname or a bang is received in the inlet, the first message that is sent out the left outlet is clear, which is intended to erase the contents of a receiving message or umenu object.
int: Out right outlet: When a pathname or a bang is received in the inlet, the number of items in the folder is sent out the right outlet.


Read in filenames from a folder then call them up from a pop-up menu

See Also

Name Description
conformpath Convert paths of one pathtype and/or pathstyle to another
dropfile Define a region for dragging and dropping a file
filein Read in a file of binary data
filepath Report information about the current Max search path
opendialog Open a dialog to ask for a file or folder
pcontrol Open and close subwindows within a patcher
umenu Pop-up menu, to display and send commands