File Exists

From SwiftAPI

Jump to: navigation, search

Contents

Java

import java.io.File;
 
boolean exists = new File("file.txt").exists();

Objective-C

BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:@"file.txt"];

Perl

$exists = -e 'file.txt';

PHP

php.net

$exists = file_exists('file.txt');

Python

docs.python.org

import os
exists = os.path.exists('file.txt')

Ruby

exists = File.exist?("file.txt")
Personal tools