This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Determine if input is folder


result = isfolder(folderName)



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


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

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