Quantcast

Documentation Center

  • Trial Software
  • Product Updates

ls

List folder contents

Syntax

ls
ls name
list = ls(name)

Description

ls lists the contents of the current folder.

ls name lists the files and folders in the current folder that match the specified name. You can use wildcards.

list = ls(name) returns the files and folders in the current folder that match the specified name to list.

Input Arguments

name

A string value specifying a file or folder name.

Output Arguments

list

  • On UNIX® platforms, list is a character row vector of names separated by tab and space characters.

  • On Microsoft® Windows® platforms, list is an m-by-n character array of names—m is the number of names and n is the number of characters in the longest name. MATLAB® pads names shorter than n characters with space characters.

Examples

List all the files and folders in the current folder:

ls
 

List all the files and folders in the current folder that begin with the letter h:

ls h*
 

Return the list of all the files and folders in the current folder to mylist:

mylist = ls;

Alternatives

  • View files and folders in the Current Folder browser.

    Open the Current Folder browser by issuing the filebrowser command.

More About

expand all

Tips

  • On UNIX platforms, you can add any flags to ls that the operating system supports.

See Also

|

Was this topic helpful?