Check if folder exists

Is there any way to check if a specific folder exists? I can’t find anything in the documentation.

But for the file there is a method …

Wouldn’t it make sense to have Dir::exists() ?

You can use is_dir():

if (is_dir('path-to-folder')) {
  echo 'Hurray, the folder exists';
} else {

Thanks :slight_smile: I also opened a ticket at Kirby ideas to include the function in a future version.

I saw that and left a comment. The purpose of the Kirby classes and methods cannot be to replace all native PHP methods if they don’t bring any advantages. That would in fact not make sense, because the native functions are usually more performant than user land methods.

You’re absolutly right :slight_smile: