Main Content

isfolder

Determine if input is folder

Description

example

result = isfolder(folderName) returns 1 if folderName is a folder located on the specified path or in the current folder. Otherwise, isfolder returns 0.

Examples

collapse all

Create the folder myfolder, then check if myfolder is a folder. A result of 1 indicates that myfolder is a folder.

mkdir myfolder;
result = isfolder('myfolder')
result = logical
   1

Check if the inputs myfile1.txt and myfolder are folders. A result of [0 1] indicates that myfile1.txt is not a folder and myfolder is a folder.

result = isfolder(["myfile1.txt", "myfolder"])
result = 1×2 logical array
   0   1

Input Arguments

collapse all

Folder name, specified as a string array, character vector, or cell array of character vectors. For a local file, folderName can include a relative path, but the relative path must be in the current folder. Otherwise, folderName must include a full path. If the folder is at a remote location, then folderName must contain a full path specified as a uniform resource locator (URL). For more information, see Work with Remote Data.

Extended Capabilities

Version History

Introduced in R2017b