Is Directory

From SwiftAPI

Jump to: navigation, search

Determine whether a file path is a directory

PHP

$path = '/tmp';
$a = is_dir($path);
 
$path = '/etc/hosts';
$b = is_dir($path);
 
// $a == true
// $b == false

Ruby

ruby-doc.org

path = '/tmp'
a = Dir.exists?(path)
 
path = '/etc/hosts'
b = Dir.exists?(path)
 
# a == true
# b == false
Personal tools