isfolder

Determine if input is folder

Syntax

result = isfolder(folderName)

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. folderName can include a relative path, but the relative path must be in the current folder. Otherwise, folderName must include a full path.

Data Types: string | cell | char

See Also

| |

Introduced in R2017b