Check that file exists: Difference between revisions

(add BQN)
 
(33 intermediate revisions by 20 users not shown)
Line 1:
{{task|File System Operations}} [[Category:Simple]]
{{task|File System Operations}}
 
;Task:
Verify that a file called     '''input.txt'''     and   a directory called     '''docs'''     exist.
Line 14:
:::* &nbsp; an unusual filename: &nbsp; <big> ''' `Abdu'l-Bahá.txt ''' </big>
<br><br>
 
=={{header|11l}}==
{{Trans|Python}}
<langsyntaxhighlight lang="11l">fs:is_file(‘input.txt’)
fs:is_file(‘/input.txt’)
fs:is_dir(‘docs’)
fs:is_dir(‘/docs’)</langsyntaxhighlight>
 
=={{header|AArch64 Assembly}}==
{{works with|as|Raspberry Pi 3B version Buster 64 bits}}
<syntaxhighlight lang="aarch64 assembly">
<lang AArch64 Assembly>
/* ARM assembly AARCH64 Raspberry PI 3B */
/* program verifFic64.s */
Line 136 ⟶ 134:
/* for this file see task include a file in language AArch64 assembly */
.include "../includeARM64.inc"
</syntaxhighlight>
</lang>
 
=={{header|Action!}}==
<langsyntaxhighlight Actionlang="action!">BYTE lastError
 
PROC MyError(BYTE errCode)
Line 179 ⟶ 176:
Test("D:INPUT.TXT")
Test("D:DOS.SYS")
RETURN</langsyntaxhighlight>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Check_that_file_exists.png Screenshot from Atari 8-bit computer]
Line 186 ⟶ 183:
File "D:DOS.SYS" exists.
</pre>
 
=={{header|Ada}}==
This example should work with any Ada 95 compiler.
<langsyntaxhighlight lang="ada">with Ada.Text_IO; use Ada.Text_IO;
 
procedure File_Exists is
Line 205 ⟶ 201:
Put_Line (Boolean'Image (Does_File_Exist ("input.txt" )));
Put_Line (Boolean'Image (Does_File_Exist ("\input.txt")));
end File_Exists;</langsyntaxhighlight>
This example should work with any Ada 2005 compiler.
<langsyntaxhighlight lang="ada">with Ada.Text_IO; use Ada.Text_IO;
with Ada.Directories; use Ada.Directories;
 
Line 226 ⟶ 222:
Print_Dir_Exist ("docs");
Print_Dir_Exist ("/docs");
end File_Exists;</langsyntaxhighlight>
 
=={{header|Aikido}}==
The <code>stat</code> function returns a <code>System.Stat</code> object for an existing file or directory, or <code>null</code> if it can't be found.
<langsyntaxhighlight lang="aikido">
function exists (filename) {
return stat (filename) != null
Line 240 ⟶ 235:
exists ("/docs")
 
</syntaxhighlight>
</lang>
 
=={{header|ALGOL 68}}==
{{works with|ALGOL 68G|Any - tested with release 2.8.3.win32}}
Uses the Algol 68G specific "file is directory" procedure to test for the existence of directories.
<langsyntaxhighlight lang="algol68"># Check files and directories exist #
 
# check a file exists by attempting to open it for input #
Line 284 ⟶ 278:
test file exists( "\input.txt");
test directory exists( "docs" );
test directory exists( "\docs" )</langsyntaxhighlight>
=={{header|Amazing Hopper}}==
Version: hopper-FLOW!:
<syntaxhighlight lang="amazing hopper">
#include <flow.h>
 
DEF-MAIN(argv, argc)
WHEN( IS-FILE?("hopper") ){
MEM("File \"hopper\" exist!\n")
}
WHEN( IS-DIR?("fl") ){
MEM("Directory \"fl\" exist!\n")
}
IF( IS-DIR?("noExisDir"), "Directory \"noExistDir\" exist!\n", \
"Directory \"noExistDir\" does NOT exist!\n" )
//"arch mañoso bacán.txt" text-file created
 
STR-TO-UTF8("File \"arch mañoso bacán.txt\" ")
IF( IS-FILE?( STR-TO-UTF8("arch mañoso bacán.txt") ), "exist!\n", "NOT exist!\n")
 
PRNL
END
</syntaxhighlight>
{{out}}
<pre>
$ hopper existFile.flw
File "hopper" exist!
Directory "fl" exist!
Directory "noExistDir" does NOT exist!
File "arch mañoso bacán.txt" exist!
$
</pre>
=={{header|APL}}==
<syntaxhighlight lang="apl">
h ← ⎕fio['fopen'] 'input.txt'
h
7
⎕fio['fstat'] h
66311 803134 33188 1 1000 1000 0 11634 4096 24 1642047105 1642047105 1642047105
⎕fio['fclose'] h
0
h ← ⎕fio['fopen'] 'docs/'
h
7
⎕fio['fstat'] h
66311 3296858 16877 2 1000 1000 0 4096 4096 8 1642047108 1642047108 1642047108
⎕fio['fclose'] h
0
h ← ⎕fio['fopen'] 'does_not_exist.txt'
h
¯1
</syntaxhighlight>
=={{header|AppleScript}}==
{{Trans|JavaScript}}
(macOS JavaScript for Automation)
<langsyntaxhighlight AppleScriptlang="applescript">use framework "Foundation" -- YOSEMITE OS X onwards
use scripting additions
 
Line 381 ⟶ 425:
end script
end if
end mReturn</langsyntaxhighlight>
{{Out}}
The first four booleans are returned by `doesFileExist`.
Line 387 ⟶ 431:
The last four are returned by `doesDirectoryExist`,
which yields false for simple files, and true for directories.
<langsyntaxhighlight AppleScriptlang="applescript">{true, true, true, true, false, false, true, true}</langsyntaxhighlight>
 
=={{header|Applesoft BASIC}}==
The error code for FILE NOT FOUND is 6.
<langsyntaxhighlight ApplesoftBasiclang="applesoftbasic">100 F$ = "THAT FILE"
110 T$(0) = "DOES NOT EXIST."
120 T$(1) = "EXISTS."
Line 412 ⟶ 455:
350 REM END TRY
360 RETURN
</syntaxhighlight>
</lang>
 
=={{header|ARM Assembly}}==
{{works with|as|Raspberry Pi}}
<syntaxhighlight lang="arm assembly">
<lang ARM Assembly>
/* ARM assembly Raspberry PI */
/* program verifFic.s */
Line 540 ⟶ 582:
pop {fp,lr} /* restaur des 2 registres */
bx lr /* return */
</syntaxhighlight>
</lang>
 
=={{header|Arturo}}==
<langsyntaxhighlight lang="rebol">checkIfExists: function [fpath][
(or? exists? fpath
exists? .directory fpath)? -> print [fpath "exists"]
Line 553 ⟶ 594:
checkIfExists "/input.txt"
checkIfExists "/docs"</langsyntaxhighlight>
 
=={{header|AutoHotkey}}==
AutoHotkey’s FileExist() function returns an attribute string (a subset of "RASHNDOCT") if a matching file or directory is found. The attribute string must be parsed for the letter D to determine whether the match is a directory or file.
Line 560 ⟶ 600:
Another option is AutoHotkey's IfExist/IfNotExist command
 
<langsyntaxhighlight lang="autohotkey">; FileExist() function examples
ShowFileExist("input.txt")
ShowFileExist("\input.txt")
Line 592 ⟶ 632:
MsgBox, folder: %folder% does NOT exist.
Return
}</langsyntaxhighlight>
 
=={{header|AWK}}==
{{works with|gawk}}
<langsyntaxhighlight lang="awk">@load "filefuncs"
 
function exists(name ,fd) {
Line 609 ⟶ 648:
exists("docs")
exists("/docs")
}</langsyntaxhighlight>
 
Portable getline method. Also works in a Windows environment.
<syntaxhighlight lang="awk">#
<lang AWK>#
# Check if file or directory exists, even 0-length file.
# Return 0 if not exist, 1 if exist
Line 636 ⟶ 675:
exists("\\docs")
exit(0)
}</langsyntaxhighlight>
 
{{works with|gawk}}
Check file(s) existence
<syntaxhighlight lang="text">gawk 'BEGINFILE{if (ERRNO) {print "Not exist."; nextfile} else {print "Exist."; nextfile}}' input.txt input-missing.txt</langsyntaxhighlight>
 
=={{header|Axe}}==
<langsyntaxhighlight lang="axe">If GetCalc("appvINPUT")
Disp "EXISTS",i
Else
Disp "DOES NOT EXIST",i
End</langsyntaxhighlight>
 
=={{header|BASIC}}==
{{works with|QBasic}}
<langsyntaxhighlight lang="qbasic">
ON ERROR GOTO ohNo
f$ = "input.txt"
Line 680 ⟶ 717:
END IF
RESUME NEXT
</syntaxhighlight>
</lang>
 
You can also check for a directory by trying to enter it.
 
<langsyntaxhighlight lang="qbasic">
ON ERROR GOTO ohNo
d$ = "docs"
Line 699 ⟶ 736:
END IF
RESUME NEXT
</syntaxhighlight>
</lang>
 
{{works with|QuickBasic|7.1}} {{works with|PowerBASIC for DOS}}
Line 705 ⟶ 742:
Later versions of MS-compatible BASICs include the <CODE>DIR$</CODE> keyword, which makes this pretty trivial.
 
<langsyntaxhighlight lang="qbasic">
f$ = "input.txt"
GOSUB opener
Line 727 ⟶ 764:
END IF
RETURN
</syntaxhighlight>
</lang>
 
==={{header|BaCon}}===
<langsyntaxhighlight lang="freebasic">' File exists
f$ = "input.txt"
d$ = "docs"
Line 745 ⟶ 782:
 
f$ = "`Abdu'l-Bahá.txt"
PRINT f$, IIF$(FILEEXISTS(f$), " exists", " does not exist")</langsyntaxhighlight>
 
{{out}}
Line 757 ⟶ 794:
==={{header|Commodore BASIC}}===
Try a file, then check the error status of the disk drive. Error code 62 is the "File not found" error. The trick is to open the file without specifying the file type (PRG, SEQ, REL, etc.) and the Read/Write mode in the OPEN statement, otherwise you may end up with error code 64 "File Type Mismatch".
<langsyntaxhighlight lang="gwbasic">10 REM CHECK FILE EXISTS
15 ER=0:EM$="":MSG$="FILE EXISTS."
20 PRINT CHR$(147);:REM CLEAR SCREEN
Line 776 ⟶ 813:
1020 INPUT#15,ER,EM$,T,S
1030 CLOSE 15
1040 RETURN</langsyntaxhighlight>
 
{{Out}}<pre>ENTER FILENAME TO CHECK? INDEX.TXT
Line 785 ⟶ 822:
'NOFILE.DOC' IS NOT HERE.</pre>
 
==={{header|SmallBASIC}}===
<syntaxhighlight lang="qbasic">
if(isdir("docs")) then print "directory docs exist"
if(isdir("/docs")) then print "directory /docs exist"
if(isfile("input.txt")) then print "file input.txt exist"
if(isfile("/input.txt")) then print "file /input.txt exist"
</syntaxhighlight>
 
 
 
=={{header|BASIC256}}==
<syntaxhighlight lang="basic256">subroutine opener (filename$)
if exists(filename$) then
print filename$; " exists"
else
print filename$; " does not exists"
end if
end subroutine
 
call opener ("input.txt")
call opener ("\input.txt")
call opener ("docs\nul")
call opener ("\docs\nul")
call opener ("empty.kbs")
call opener ("`Abdu'l-Bahá.txt"))
end</syntaxhighlight>
=={{header|Batch File}}==
<langsyntaxhighlight lang="dos">if exist input.txt echo The following file called input.txt exists.
if exist \input.txt echo The following file called \input.txt exists.
if exist docs echo The following directory called docs exists.
if exist \docs\ echo The following directory called \docs\ exists.</langsyntaxhighlight>
 
=={{header|BBC BASIC}}==
<langsyntaxhighlight lang="bbcbasic"> test% = OPENIN("input.txt")
IF test% THEN
CLOSE #test%
Line 814 ⟶ 876:
CLOSE #test%
PRINT "Directory \docs exists"
ENDIF</langsyntaxhighlight>
 
=={{header|BQN}}==
 
Line 822 ⟶ 883:
Takes filename as a command line argument, tells whether it exists.
 
<langsyntaxhighlight BQNlang="bqn">fname ← ⊑args
•Out fname∾" Does not exist"‿" Exists"⊑˜•File.exists fname</langsyntaxhighlight>
 
=={{header|C}}==
{{libheader|POSIX}}
<langsyntaxhighlight lang="c">#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
Line 854 ⟶ 914:
check_dir("/docs") ? "yes" : "no");
return 0;
}</langsyntaxhighlight>
 
{{libheader|Gadget}}
<syntaxhighlight lang="c">
#include <gadget/gadget.h>
 
LIB_GADGET_START
 
/* input.txt = check_file.c
docs = tests */
 
Main
Print "tests/check_file.c is a regular file? %s\n", Exist_file("tests/check_file.c") ? "yes" : "no";
Print "tests is a directory? %s\n", Exist_dir("tests") ? "yes" : "no";
Print "some.txt is a regular file? %s\n", Exist_file("some.txt") ? "yes" : "no";
Print "/tests is a directory? %s\n", Exist_dir("/tests") ? "yes" : "no";
End
</syntaxhighlight>
{{out}}
<pre>
tests/check_file.c is a regular file? yes
tests is a directory? yes
some.txt is a regular file? no
/tests is a directory? no
 
</pre>
 
=={{header|C sharp|C#}}==
 
<langsyntaxhighlight lang="csharp">using System.IO;
 
Console.WriteLine(File.Exists("input.txt"));
Console.WriteLine(File.Exists("/input.txt"));
Console.WriteLine(Directory.Exists("docs"));
Console.WriteLine(Directory.Exists("/docs"));</langsyntaxhighlight>
 
=={{header|C++}}==
{{libheader|boost}}
<langsyntaxhighlight lang="cpp">#include "boost/filesystem.hpp"
#include <string>
#include <iostream>
Line 891 ⟶ 975:
testfile("/input.txt");
testfile("/docs");
}</langsyntaxhighlight>
 
===Using C++ 17===
C++ 17 contains a Filesystem library which significantly improves operations with files.
<syntaxhighlight lang="c++">
 
#include <iostream>
#include <filesystem>
 
void file_exists(const std::filesystem::path& path) {
std::cout << path;
if ( std::filesystem::exists(path) ) {
if ( std::filesystem::is_directory(path) ) {
std::cout << " is a directory" << std::endl;
} else {
std::cout << " exists with a file size of " << std::filesystem::file_size(path) << " bytes." << std::endl;
}
} else {
std::cout << " does not exist" << std::endl;
}
}
 
int main() {
file_exists("input.txt");
file_exists("zero_length.txt");
file_exists("docs/input.txt");
file_exists("docs/zero_length.txt");
}
</syntaxhighlight>
{{ out }}
</pre>
"input.txt" exists with a file size of 11 bytes.
 
"zero_length.txt" exists with a file size of 0 bytes.
 
"docs/input.txt" exists with a file size of 11 bytes.
 
"docs/zero_length.txt" exists with a file size of 0 bytes.
</pre>
 
=={{header|Clojure}}==
<langsyntaxhighlight lang="clojure">
 
(dorun (map #(.exists (clojure.java.io/as-file %)) '("/input.txt" "/docs" "./input.txt" "./docs")))
 
</syntaxhighlight>
</lang>
 
=={{header|COBOL}}==
{{works with|GnuCOBOL}} and other compilers with this system call extension
<langsyntaxhighlight COBOLlang="cobol"> identification division.
program-id. check-file-exist.
 
Line 972 ⟶ 1,093:
 
end program check-file-exist.
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 989 ⟶ 1,110:
error: CBL_CHECK_FILE_EXIST +000000035 /docs/</pre>
Errors due to file and dir not existing in root directory for this test pass
 
=={{header|CoffeeScript}}==
{{works with|Node.js}}
<langsyntaxhighlight lang="coffeescript">
fs = require 'fs'
path = require 'path'
Line 1,015 ⟶ 1,135:
 
</syntaxhighlight>
</lang>
 
=={{header|Common Lisp}}==
 
''probe-file'' returns ''nil'' if a file does not exist. ''directory'' returns ''nil'' if there are no files in a specified directory.
<langsyntaxhighlight lang="lisp">(if (probe-file (make-pathname :name "input.txt"))
(print "rel file exists"))
(if (probe-file (make-pathname :directory '(:absolute "") :name "input.txt"))
Line 1,030 ⟶ 1,149:
(if (directory (make-pathname :directory '(:absolute "docs")))
(print "abs directory exists")
(print "abs directory is not known to exist"))</langsyntaxhighlight>
 
There is no standardized way to determine if an empty directory exists, as Common Lisp dates from before the notion of directories as a type of file was near-universal. [http://www.weitz.de/cl-fad/ CL-FAD] provides many of the therefore-missing capabilities in a cross-implementation library.
 
{{libheader|CL-FAD}}
<langsyntaxhighlight lang="lisp">(if (cl-fad:directory-exists-p (make-pathname :directory '(:relative "docs")))
(print "rel directory exists")
(print "rel directory does not exist"))</langsyntaxhighlight>
 
=={{header|Crystal}}==
<langsyntaxhighlight lang="ruby">def check_file(filename : String)
if File.directory?(filename)
puts "#{filename} is a directory"
Line 1,053 ⟶ 1,171:
check_file("docs")
check_file("/input.txt")
check_file("/docs")</langsyntaxhighlight>
 
=={{header|D}}==
<langsyntaxhighlight lang="d">import std.stdio, std.file, std.path;
 
void verify(in string name) {
Line 1,073 ⟶ 1,190:
verify(dirSeparator ~ "input.txt");
verify(dirSeparator ~ "docs");
}</langsyntaxhighlight>
{{out}}
<pre>'input.txt' doesn't exist
Line 1,079 ⟶ 1,196:
'\input.txt' doesn't exist
'\docs' doesn't exist</pre>
 
=={{header|DBL}}==
<syntaxhighlight lang="dbl">;
<lang DBL>;
; Check file and directory exists for DBL version 4 by Dario B.
;
Line 1,115 ⟶ 1,231:
CLOS, CLOSE 1
CLOSE 2
STOP</langsyntaxhighlight>
 
=={{header|DCL}}==
<langsyntaxhighlight DCLlang="dcl">$ if f$search( "input.txt" ) .eqs. ""
$ then
$ write sys$output "input.txt not found"
Line 1,141 ⟶ 1,256:
$ else
$ write sys$output "directory [000000]docs found"
$ endif</langsyntaxhighlight>
{{out}}
<pre>
Line 1,149 ⟶ 1,264:
[000000]input.txt not found
directory [000000]docs not found</pre>
 
=={{header|Delphi}}==
<langsyntaxhighlight Delphilang="delphi">program EnsureFileExists;
 
{$APPTYPE CONSOLE}
Line 1,178 ⟶ 1,292:
else
Writeln('Directory "\docs" does not exists.');
end.</langsyntaxhighlight>
 
=={{header|E}}==
<langsyntaxhighlight lang="e">for file in [<file:input.txt>,
<file:///input.txt>] {
require(file.exists(), fn { `$file is missing!` })
Line 1,191 ⟶ 1,304:
require(file.exists(), fn { `$file is missing!` })
require(file.isDirectory(), fn { `$file is not a directory!` })
}</langsyntaxhighlight>
 
=={{header|Elena}}==
ELENA 4.x :
<langsyntaxhighlight lang="elena">import system'io;
import extensions;
 
Line 1,213 ⟶ 1,325:
console.printLine("\docs directory ",Directory.assign("\docs").validatePath())
}</langsyntaxhighlight>
 
=={{header|Elixir}}==
<langsyntaxhighlight Elixirlang="elixir">File.regular?("input.txt")
File.dir?("docs")
File.regular?("/input.txt")
File.dir?("/docs")</langsyntaxhighlight>
 
=={{header|Emacs Lisp}}==
<langsyntaxhighlight Lisplang="lisp">(file-exists-p "input.txt")
(file-directory-p "docs")
(file-exists-p "/input.txt")
(file-directory-p "/docs")</langsyntaxhighlight>
 
<code>file-exists-p</code> is true on both files and directories. <code>file-directory-p</code> is true only on directories. Both go through the <code>file-name-handler-alist</code> "magic filenames" mechanism so can act on remote files. On MS-DOS generally both <code>/</code> and <code>\</code> work to specify the root directory.
 
=={{header|Erlang}}==
<langsyntaxhighlight lang="erlang">#!/usr/bin/escript
existence( true ) ->"exists";
existence( false ) ->"does not exist".
Line 1,242 ⟶ 1,351:
print_result( "File", "/input.txt", filelib:is_regular("/input.txt") ),
print_result( "Directory", "/docs", filelib:is_dir("/docs") ).
</syntaxhighlight>
</lang>
 
=={{header|Euphoria}}==
<langsyntaxhighlight lang="euphoria">include file.e
 
procedure ensure_exists(sequence name)
Line 1,266 ⟶ 1,374:
ensure_exists("docs")
ensure_exists("/input.txt")
ensure_exists("/docs")</langsyntaxhighlight>
 
=={{header|F_Sharp|F#}}==
<langsyntaxhighlight lang="fsharp">open System.IO
File.Exists("input.txt")
Directory.Exists("docs")
File.Exists("/input.txt")
Directory.Exists(@"\docs")</langsyntaxhighlight>
 
=={{header|Factor}}==
<langsyntaxhighlight lang="factor">: print-exists? ( path -- )
[ write ": " write ] [ exists? "exists." "doesn't exist." ? print ] bi ;
 
{ "input.txt" "/input.txt" "docs" "/docs" } [ print-exists? ] each</langsyntaxhighlight>
 
=={{header|Forth}}==
 
<syntaxhighlight lang ="forth">: .exists ( str len -- ) 2dup file-status nip 0= if ." exists" else ." does not exist" then type ;
2dup file-status nip 0= if
s" input.txt" .exists
s" /input .txt" .exists: "
else
s" docs" .exists
." does not exist: "
s" /docs" .exists</lang>
then
type
;
 
s" input.txt" .exists cr
s" /input.txt" .exists cr
s" docs" .exists cr
s" /docs" .exists cr
</syntaxhighlight>
 
=={{header|Fortran}}==
Line 1,293 ⟶ 1,407:
 
Cannot check for directories in Fortran
<langsyntaxhighlight lang="fortran">LOGICAL :: file_exists
INQUIRE(FILE="input.txt", EXIST=file_exists) ! file_exists will be TRUE if the file
! exists and FALSE otherwise
INQUIRE(FILE="/input.txt", EXIST=file_exists)</langsyntaxhighlight>
 
Actually, f90,f95 are able to deal with directory staff:
 
<langsyntaxhighlight lang="fortran">logical :: dir_e
! a trick to be sure docs is a dir
inquire( file="./docs/.", exist=dir_e )
Line 1,308 ⟶ 1,422:
! workaround: it calls an extern program...
call system('mkdir docs')
end if</langsyntaxhighlight>
 
=={{header|FreeBASIC}}==
<langsyntaxhighlight lang="freebasic">' FB 1.05.0 Win64
 
' Enable FileExists() function to be used
Line 1,348 ⟶ 1,461:
Print
Print "Press any key to quit the program"
Sleep</langsyntaxhighlight>
 
{{out}}
Line 1,358 ⟶ 1,471:
'c:\docs' exists
</pre>
 
 
 
=={{header|Frink}}==
This checks that the file exists and is a file, and that the directory exists, and is a directory. (Many of the samples on this page do not check that the files are actually a file or the directories are actually a directory.) It also tries to find various Unicode encodings of the "unusual" filename that may be encoded in different Unicode compositions (e.g. using "precomposed" or "decomposed" representations for some characters.
 
<langsyntaxhighlight lang="frink">
checkFile[filename] :=
{
Line 1,397 ⟶ 1,512:
checkFile[normalizeUnicode[unusual, "NFC"]]
checkFile[normalizeUnicode[unusual, "NFD"]]
</syntaxhighlight>
</lang>
 
 
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
include "NSLog.incl"
 
CFURLRef url
url = fn URLFileURLWithPath( fn StringByExpandingTildeInPath(@"~/Desktop/input.txt") )
if (fn FileManagerFileExistsAtURL( url ) )
NSLog( @"File \"input.txt\" exists." )
else
NSLog( @"File \"input.txt\" does not exist at this location." )
end if
 
url = fn URLFileURLWithPath( fn StringByExpandingTildeInPath(@"~/Desktop/docs") )
if (fn FileManagerIsDirectoryAtURL( url ) )
NSLog( @"Directory \"docs\" exists." )
else
NSLog( @"Directory \"docs\" does not exist at this location." )
end if
 
HandleEvents
</syntaxhighlight>
 
=={{header|Gambas}}==
'''[https://gambas-playground.proko.eu/?gist=fa06b7cc43166fb0ab48e878d86e3d1b Click this link to run this code]'''
<langsyntaxhighlight lang="gambas">Public Sub Main()
 
If Exist(User.Home &/ "input.txt") Then Print "'input.txt' does exist in the Home folder"
Line 1,412 ⟶ 1,550:
If Exist(User.Home &/ "`Abdu'l-Bahá.txt") Then Print "'`Abdu'l-Bahá.txt' does exist (zero length and unusual name)"
 
End</langsyntaxhighlight>
Output:
<pre>
Line 1,421 ⟶ 1,559:
'`Abdu'l-Bahá.txt' does exist (zero length and unusual name)
</pre>
 
 
 
=={{header|GAP}}==
<langsyntaxhighlight lang="gap">IsExistingFile("input.txt");
IsDirectoryPath("docs");
IsExistingFile("/input.txt");
IsDirectoryPath("/docs");</langsyntaxhighlight>
 
=={{header|Genie}}==
<langsyntaxhighlight lang="genie">[indent=4]
/*
Check file exists, in Genie
Line 1,446 ⟶ 1,585:
if exists
dir = file.query_file_type(0) == FileType.DIRECTORY
print("%s %sexist%s%s", f, exists ? "" : "does not ", exists ? "s" : "", dir ? " and is a directory" : "")</langsyntaxhighlight>
 
{{out}}
Line 1,458 ⟶ 1,597:
 
For the run, ''input.txt'' was zero length.
 
=={{header|Go}}==
<langsyntaxhighlight lang="go">package main
 
import (
Line 1,483 ⟶ 1,621:
printStat("docs")
printStat("/docs")
}</langsyntaxhighlight>
 
=={{header|Groovy}}==
<langsyntaxhighlight lang="groovy">println new File('input.txt').exists()
println new File('/input.txt').exists()
println new File('docs').exists()
println new File('/docs').exists()</langsyntaxhighlight>
 
=={{header|Haskell}}==
 
<langsyntaxhighlight lang="haskell">import System.Directory (doesFileExist, doesDirectoryExist)
 
check :: (FilePath -> IO Bool) -> FilePath -> IO ()
Line 1,509 ⟶ 1,645:
check doesDirectoryExist "docs"
check doesFileExist "/input.txt"
check doesDirectoryExist "/docs"</langsyntaxhighlight>
 
=={{header|hexiscript}}==
<langsyntaxhighlight lang="hexiscript">println "File \"input.txt\"? " + (exists "input.txt")
println "Dir \"docs\"? " + (exists "docs/")
println "File \"/input.txt\"? " + (exists "/input.txt")
println "Dir \"/docs\"? " + (exists "/docs/")</langsyntaxhighlight>
 
=={{header|HicEst}}==
<langsyntaxhighlight lang="hicest"> OPEN(FIle= 'input.txt', OLD, IOStat=ios, ERror=99)
OPEN(FIle='C:\input.txt', OLD, IOStat=ios, ERror=99)
! ...
99 WRITE(Messagebox='!') 'File does not exist. Error message ', ios </langsyntaxhighlight>
 
=={{header|HolyC}}==
<langsyntaxhighlight lang="holyc">U0 FileExists(U8 *f) {
if (FileFind(f) && !IsDir(f)) {
Print("'%s' file exists.\n", f);
Line 1,543 ⟶ 1,676:
FileExists("::/input.txt");
DirExists("docs");
DirExists("::/docs");</langsyntaxhighlight>
 
=={{header|i}}==
<langsyntaxhighlight lang="i">concept exists(path) {
open(path)
errors {
Line 1,563 ⟶ 1,695:
exists("/docs")
exists("docs/Abdu'l-Bahá.txt")
}</langsyntaxhighlight>
 
=={{header|Icon}} and {{header|Unicon}}==
Icon doesn't support 'stat'; however, information can be obtained by use of the system function to access command line.
<langsyntaxhighlight Uniconlang="unicon">every dir := !["./","/"] do {
write("file ", f := dir || "input.txt", if stat(f) then " exists." else " doesn't exist.")
write("directory ", f := dir || "docs", if stat(f) then " exists." else " doesn't exist.")
}</langsyntaxhighlight>
Note: Icon and Unicon accept both / and \ for directory separators.
 
=={{header|IDL}}==
<langsyntaxhighlight lang="idl">
print, FILE_TEST('input.txt')
print, FILE_TEST(PATH_SEP()+'input.txt')
Line 1,580 ⟶ 1,710:
print, FILE_TEST(PATH_SEP()+'docs', /DIRECTORY)
 
</syntaxhighlight>
</lang>
 
=={{header|J}}==
<langsyntaxhighlight lang="j">require 'files'
fexist 'input.txt'
fexist '/input.txt'
direxist=: 2 = ftype
direxist 'docs'
direxist '/docs'</langsyntaxhighlight>
 
=={{header|Java}}==
This can be done with a <code>File</code> object.<br />
<lang java>import java.io.File;
<syntaxhighlight lang="java">
new File("docs/input.txt").exists();
new File("/docs/input.txt").exists();
</syntaxhighlight>
Zero-length files are not a problem, and return as existent.<br />
Java supports UTF-16, so the unusual file name is not a problem.
<syntaxhighlight lang="java">
new File("`Abdu'l-Bahá.txt").exists()
</syntaxhighlight>
<syntaxhighlight lang="java">
new File("`Abdu'l-Bah\u00E1.txt").exists();
</syntaxhighlight>
<br />
Alternately
<syntaxhighlight lang="java">import java.io.File;
public class FileExistsTest {
public static boolean isFileExists(String filename) {
Line 1,608 ⟶ 1,751:
test("directory", File.separator + "docs" + File.separator);
}
}</langsyntaxhighlight>
{{works with|Java|7+}}
<langsyntaxhighlight lang="java5">import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
Line 1,629 ⟶ 1,772:
test("directory", defaultFS.getSeparator() + "docs" + defaultFS.getSeparator());
}
}</langsyntaxhighlight>
 
=={{header|JavaScript}}==
Line 1,635 ⟶ 1,778:
Each non-browser JS context is likely to have its own home-grown and unstandardised file system library.
===JScript===
<langsyntaxhighlight lang="javascript">var fso = new ActiveXObject("Scripting.FileSystemObject");
 
fso.FileExists('input.txt');
fso.FileExists('c:/input.txt');
fso.FolderExists('docs');
fso.FolderExists('c:/docs');</langsyntaxhighlight>
 
===macOS JavaScript for Automation===
Line 1,646 ⟶ 1,789:
{{Trans|Haskell}}
(Adopting function names used in the Haskell System.Directory library)
<langsyntaxhighlight JavaScriptlang="javascript">(() => {
 
// SYSTEM DIRECTORY FUNCTIONS
Line 1,719 ⟶ 1,862:
))
);
})();</langsyntaxhighlight>
{{Out}}
The first four booleans are returned by doesFileExist – the last four by
Line 1,734 ⟶ 1,877:
true
]</pre>
 
=={{header|Julia}}==
{{works with|Julia|0.6}}
 
<langsyntaxhighlight lang="julia">@show isfile("input.txt")
@show isfile("/input.txt")
@show isdir("docs")
@show isdir("/docs")
@show isfile("")
@show isfile("`Abdu'l-Bahá.txt")</langsyntaxhighlight>
 
=={{header|Klingphix}}==
<langsyntaxhighlight Klingphixlang="klingphix">include ..\Utilitys.tlhy
 
"foo.bar" "w" fopen
Line 1,755 ⟶ 1,896:
dup 0 < ( ["Could not open 'fou.bar' for reading" print drop] [fclose] ) if
 
" " input</langsyntaxhighlight>
{{out}}
<pre>Could not open 'fou.bar' for reading</pre>
 
=={{header|Kotlin}}==
<langsyntaxhighlight lang="scala">// version 1.0.6
 
import java.io.File
Line 1,775 ⟶ 1,915:
println("$dirPath ${if (d.exists() && d.isDirectory) "exists" else "does not exist"}")
}
}</langsyntaxhighlight>
 
=={{header|LabVIEW}}==
{{libheader|LabVIEW CWD}}
{{VI snippet}}<br/>
[[File:Ensure_that_a_file_exists.png]]
 
 
=={{header|Lang}}==
{{libheader|lang-io-module}}
<syntaxhighlight lang="lang">
# Load the IO module
# Replace "<pathToIO.lm>" with the location where the io.lm Lang module was installed to without "<" and ">"
ln.loadModule(<pathToIO.lm>)
 
$file1 = [[io]]::fp.openFile(input.txt)
[[io]]::fp.existsFile($file1)
[[io]]::fp.closeFile($file1)
 
$file2 = [[io]]::fp.openFile(/input.txt)
[[io]]::fp.existsFile($file2)
[[io]]::fp.closeFile($file2)
 
$dir1 = [[io]]::fp.openFile(docs)
[[io]]::fp.existsFile($dir1)
[[io]]::fp.closeFile($dir1)
 
$dir2 = [[io]]::fp.openFile(/docs)
[[io]]::fp.existsFile($dir2)
[[io]]::fp.closeFile($dir2)
</syntaxhighlight>
 
=={{header|langur}}==
The prop() function returns a hash of file/directory properties.
<syntaxhighlight lang="langur">val .printresult = impure fn(.file) {
write .file, ": "
if val .p = prop(.file) {
if .p'isdir {
writeln "is directory"
} else {
writeln "is file"
}
} else {
writeln "nothing"
}
}
 
.printresult("input.txt")
.printresult("/input.txt")
.printresult("docs")
.printresult("/docs")
</syntaxhighlight>
 
=={{header|Lasso}}==
<langsyntaxhighlight Lassolang="lasso">// local file
file_exists('input.txt')
 
Line 1,793 ⟶ 1,978:
 
// directory in root file system (requires permissions at user OS level)
file_exists('//docs')</langsyntaxhighlight>
 
=={{header|LFE}}==
From the LFE REPL:
<langsyntaxhighlight lang="lisp">
> (: filelib is_regular '"input.txt")
false
Line 1,806 ⟶ 1,990:
> (: filelib is_dir '"/docs"))
false
</syntaxhighlight>
</lang>
 
=={{header|Liberty BASIC}}==
<langsyntaxhighlight lang="lb">'fileExists.bas - Show how to determine if a file exists
dim info$(10,10)
input "Type a file path (ie. c:\windows\somefile.txt)?"; fpath$
Line 1,837 ⟶ 2,020:
pathLength = len(pathOnly$(fullPath$))
filenameOnly$ = right$(fullPath$, len(fullPath$)-pathLength)
end function</langsyntaxhighlight>
 
=={{header|Little}}==
<langsyntaxhighlight Clang="c">if (exists("input.txt")) {
puts("The file \"input.txt\" exist");
}
Line 1,851 ⟶ 2,033:
if (exists("/docs")) {
puts("The file \"/docs\" exist");
}</langsyntaxhighlight>
 
=={{header|LiveCode}}==
<langsyntaxhighlight LiveCodelang="livecode">there is a file "/input.txt"
there is a file "input.txt"
there is a folder "docs"
there is a file "/docs/input.txt"</langsyntaxhighlight>
LiveCode also allows setting a default folder for subsequent file commands. To check if a file exists in the doc folder
<langsyntaxhighlight LiveCodelang="livecode">set the defaultFolder to "docs"
there is a file "input.txt"</langsyntaxhighlight>
 
=={{header|Logo}}==
{{works with|UCB Logo}}
<langsyntaxhighlight lang="logo">show file? "input.txt
show file? "/input.txt
show file? "docs
show file? "/docs</langsyntaxhighlight>
Alternatively, one can set a file prefix used for subsequent file commands.
<langsyntaxhighlight lang="logo">setprefix "/
show file? "input.txt</langsyntaxhighlight>
 
=={{header|Lua}}==
For directories, the following only works on platforms on which directories can be opened for reading like files.
<langsyntaxhighlight lang="lua">function output( s, b )
if b then
print ( s, " does not exist." )
Line 1,885 ⟶ 2,064:
output( "/input.txt", io.open( "/input.txt", "r" ) == nil )
output( "docs", io.open( "docs", "r" ) == nil )
output( "/docs", io.open( "/docs", "r" ) == nil )</langsyntaxhighlight>
 
The following more portable solution uses LuaFileSystem.
<langsyntaxhighlight lang="lua">require "lfs"
for i, path in ipairs({"input.txt", "/input.txt", "docs", "/docs"}) do
local mode = lfs.attributes(path, "mode")
Line 1,896 ⟶ 2,075:
print(path .. " does not exist.")
end
end</langsyntaxhighlight>
 
=={{header|M2000 Interpreter}}==
Report print proportional text using word wrap, and justification. Can be used to calculate lines, and to render form a line, a number of lines. We can specify the width of the text, and by moving the cursor horizontal we can specify the left margin. This statement can be used to any layer, including user forms and printer page.
 
<syntaxhighlight lang="m2000 interpreter">
<lang M2000 Interpreter>
Module ExistDirAndFile {
Let WorkingDir$=Dir$, RootDir$="C:\"
Line 1,920 ⟶ 2,098:
}
ExistDirAndFile
</syntaxhighlight>
</lang>
 
=={{header|Maple}}==
<langsyntaxhighlight Maplelang="maple">with(FileTools):
Exists("input.txt");
Exists("docs") and IsDirectory("docs");
Exists("/input.txt");
Exists("/docs") and IsDirectory("/docs");</langsyntaxhighlight>
 
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<langsyntaxhighlight Mathematicalang="mathematica">wd = NotebookDirectory[];
FileExistsQ[wd <> "input.txt"]
DirectoryQ[wd <> "docs"]
 
FileExistsQ["/" <> "input.txt"]
DirectoryQ["/" <> "docs"]</langsyntaxhighlight>
 
=={{header|MATLAB}} / {{header|Octave}}==
<langsyntaxhighlight Matlablang="matlab"> exist('input.txt','file')
exist('/input.txt','file')
exist('docs','dir')
exist('/docs','dir')</langsyntaxhighlight>
 
=={{header|MAXScript}}==
<langsyntaxhighlight lang="maxscript">-- Here
doesFileExist "input.txt"
(getDirectories "docs").count == 1
-- Root
doesFileExist "\input.txt"
(getDirectories "C:\docs").count == 1</langsyntaxhighlight>
 
=={{header|Modula-3}}==
<langsyntaxhighlight lang="modula3">MODULE FileTest EXPORTS Main;
 
IMPORT IO, Fmt, FS, File, OSError, Pathname;
Line 1,972 ⟶ 2,145:
IO.Put(Fmt.Bool(FileExists("docs/")) & "\n");
IO.Put(Fmt.Bool(FileExists("/docs")) & "\n");
END FileTest.</langsyntaxhighlight>
 
=={{header|Nanoquery}}==
<langsyntaxhighlight Nanoquerylang="nanoquery">import Nanoquery.IO
 
def exists(fname)
Line 1,981 ⟶ 2,153:
 
return f.exists()
end</langsyntaxhighlight>
 
=={{header|Neko}}==
<syntaxhighlight lang="actionscript">/**
<lang ActionScript>/**
Check that file/dir exists, in Neko
*/
Line 2,008 ⟶ 2,179:
 
name = "`Abdu'l-Bahá.txt"
$print(name, " exists as file: ", sys_exists(name) && sys_file_type(name) == "file", "\n")</langsyntaxhighlight>
 
{{out}}
Line 2,021 ⟶ 2,192:
empty.txt exists as empty file: true
`Abdu'l-Bahá.txt exists as file: true</pre>
 
=={{header|Nemerle}}==
{{trans|C#}}
<langsyntaxhighlight Nemerlelang="nemerle">using System.Console;
using System.IO;
Line 2,030 ⟶ 2,200:
WriteLine(File.Exists("/input.txt"));
WriteLine(Directory.Exists("docs"));
WriteLine(Directory.Exists("/docs"));</langsyntaxhighlight>
 
=={{header|NetRexx}}==
<langsyntaxhighlight NetRexxlang="netrexx">/* NetRexx */
options replace format comments java crossref symbols binary
 
Line 2,077 ⟶ 2,246:
 
return
</syntaxhighlight>
</lang>
 
=={{header|NewLISP}}==
<langsyntaxhighlight NewLISPlang="newlisp">(dolist (file '("input.txt" "/input.txt"))
(if (file? file true)
(println "file " file " exists")))
Line 2,086 ⟶ 2,254:
(dolist (dir '("docs" "/docs"))
(if (directory? dir)
(println "directory " dir " exists")))</langsyntaxhighlight>
 
=={{header|Nim}}==
<langsyntaxhighlight lang="nim">import os
 
echo fileExists "input.txt"
echo fileExists "/input.txt"
echo dirExists "docs"
echo dirExists "/docs"</langsyntaxhighlight>
 
=={{header|Objeck}}==
<langsyntaxhighlight lang="objeck">
use IO;
 
Line 2,109 ⟶ 2,275:
}
}
</syntaxhighlight>
</lang>
 
=={{header|Objective-C}}==
<langsyntaxhighlight lang="objc">NSFileManager *fm = [NSFileManager defaultManager];
NSLog(@"input.txt %s", [fm fileExistsAtPath:@"input.txt"] ? @"exists" : @"doesn't exist");
NSLog(@"docs %s", [fm fileExistsAtPath:@"docs"] ? @"exists" : @"doesn't exist");</langsyntaxhighlight>
 
=={{header|Odin}}==
 
<syntaxhighlight lang="odin">package main
 
import "core:os"
 
main :: proc() {
os.exists("input.txt")
os.exists("/input.txt")
os.exists("docs")
os.exists("/docs")
}</syntaxhighlight>
 
=={{header|OCaml}}==
<langsyntaxhighlight lang="ocaml">Sys.file_exists "input.txt";;
Sys.file_exists "docs";;
Sys.file_exists "/input.txt";;
Sys.file_exists "/docs";;</langsyntaxhighlight>
 
=={{header|ooRexx}}==
<langsyntaxhighlight lang="oorexx">/**********************************************************************
* exists(filespec)
* returns 1 if filespec identifies a file with size>0
Line 2,142 ⟶ 2,320:
End
If size=0 Then Say spec 'is a zero-size file'
Return 0</langsyntaxhighlight>
 
=={{header|Oz}}==
<langsyntaxhighlight lang="oz">declare
[Path] = {Module.link ['x-oz://system/os/Path.ozf']}
in
Line 2,151 ⟶ 2,328:
{Show {Path.exists "input.txt"}}
{Show {Path.exists "/docs"}}
{Show {Path.exists "/input.txt"}}</langsyntaxhighlight>
 
=={{header|PARI/GP}}==
<langsyntaxhighlight lang="parigp">trap(,"does not exist",read("input.txt");"exists")
trap(,"does not exist",read("c:\\input.txt");"exists")
trap(,"does not exist",read("c:\\dirname\\nul");"exists")</langsyntaxhighlight>
 
A better version would use <code>externstr</code>.
 
Under PARI it would typically be more convenient to use [[#C|C]] methods.
 
=={{header|Pascal}}==
See [[Ensure_that_a_file_exists#Delphi | Delphi]]
 
=={{header|Perl}}==
<langsyntaxhighlight lang="perl">use File::Spec::Functions qw(catfile rootdir);
# here
print -e 'input.txt';
Line 2,172 ⟶ 2,346:
# root dir
print -e catfile rootdir, 'input.txt';
print -d catfile rootdir, 'docs';</langsyntaxhighlight>
 
'''Without a Perl Module'''
Line 2,181 ⟶ 2,355:
perl -e 'print -e "/input.txt", "\n";'
perl -e 'print -d "/docs", "\n";'
 
=={{header|Phix}}==
{{libheader|Phix/basics}}
<!--<langsyntaxhighlight Phixlang="phix">(notonline)-->
<span style="color: #008080;">procedurewithout</span> <span style="color: #000000008080;">checkjs</span> style="color: #0000FF;">(<span style="color: #004080000080;">string</span> <span font-style="color: #000000italic;">name<span-- style="color:(file #0000FF;">i/o)</span>
<span style="color: #004080008080;">boolprocedure</span> <span style="color: #000000;">bExistscheck</span> <span style="color: #0000FF;">=(</span> <span style="color: #7060A8004080;">file_existsstring</span> style="color: #0000FF;">(<span style="color: #000000;">name</span style="color: #0000FF;">)<span style="color: #0000FF;">,)</span>
<span style="color: #000000004080;">bDirbool</span> <span style="color: #0000FF000000;">=bExists</span> <span style="color: #7060A80000FF;">get_file_type=</span> style="color: #0000FF;">(<span style="color: #0000007060A8;">namefile_exists</span><span style="color: #0000FF;">)(</span><span style="color: #0000FF000000;">=name</span><span style="color: #0046000000FF;">FILETYPE_DIRECTORY),</span>
<span style="color: #004080;">string</span> <span style="color: #000000;">existsbDir</span> <span style="color: #0000FF;">=</span> <span style="color: #0080807060A8;">iffget_file_type</span><span style="color: #0000FF;">(</span style="color: #000000;">bExists<span style="color: #0000FF000000;">?name</span style="color: #008000;">"exists"<span style="color: #0000FF;">:<span style)="color: #008000;">"does not exist"</span style="color: #0000FF;">)<span style="color: #0000FF004600;">,FILETYPE_DIRECTORY</span>
<span style="color: #000000004080;">dfsstring</span> <span style="color: #0000FF000000;">=exists</span> <span style="color: #0080800000FF;">iff<span style="color: #0000FF;">(</span style="color: #000000;">bExists<span style="color: #0000FF;">?<span style="color: #008080;">iff</span><span style="color: #0000FF;">(</span style="color: #000000;">bDir<span style="color: #0000FF000000;">?bExists</span style="color: #008000;">"directory "<span style="color: #0000FF;">:?</span><span style="color: #008000;">"file exists"</span style="color: #0000FF;">)<span style="color: #0000FF;">:</span><span style="color: #008000;">"does not exist"</span><span style="color: #0000FF;">),</span>
<span style="color: #7060A8000000;">printfdfs</span> <span style="color: #0000FF;">(=</span> <span style="color: #000000008080;">1iff</span><span style="color: #0000FF;">,(</span><span style="color: #008000000000;">bExists</span><span style="%s%scolor: %s.\n#0000FF;">?</span><span style="color: #0000FF008080;">,iff</span><span style="color: #0000FF;">{(</span><span style="color: #000000;">dfsbDir</span><span style="color: #0000FF;">,?</span><span style="color: #000000008000;">name"directory "</span><span style="color: #0000FF;">,:</span><span style="color: #000000008000;">exists"file "</span><span style="color: #0000FF;">}):</span><span style="color: #008000;">""</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"%s%s %s.\n"</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">dfs</span><span style="color: #0000FF;">,</span><span style="color: #000000;">name</span><span style="color: #0000FF;">,</span><span style="color: #000000;">exists</span><span style="color: #0000FF;">})</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">procedure</span>
<span style="color: #000000;">check</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"input.txt"</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">check</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"docs"</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">check</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"/input.txt"</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">check</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"/docs"</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">check</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"/pagefile.sys"</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">check</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"/Program Files (x86)"</span><span style="color: #0000FF;">)</span>
<!--</langsyntaxhighlight>-->
{{out}}
<pre>
Line 2,209 ⟶ 2,383:
directory /Program Files (x86) exists.
</pre>
 
=={{header|Phixmonti}}==
<langsyntaxhighlight Phixmontilang="phixmonti">"foo.bar" "w" fopen
"Hallo !" over fputs
fclose
 
"fou.bar" "r" fopen
dup 0 < if "Could not open 'foo.bar' for reading" print drop else fclose endif</langsyntaxhighlight>
 
=={{header|PHP}}==
<langsyntaxhighlight lang="php">if (file_exists('input.txt')) echo 'input.txt is here right by my side';
if (file_exists('docs' )) echo 'docs is here with me';
if (file_exists('/input.txt')) echo 'input.txt is over there in the root dir';
if (file_exists('/docs' )) echo 'docs is over there in the root dir';</langsyntaxhighlight>
 
=={{header|PicoLisp}}==
<langsyntaxhighlight PicoLisplang="picolisp">(if (info "file.txt")
(prinl "Size: " (car @) " bytes, last modified " (stamp (cadr @) (cddr @)))
(prinl "File doesn't exist") )
Line 2,245 ⟶ 2,416:
((=T (car I)) "Is not a directory")
(NIL "Directory exists") ) ) )
</syntaxhighlight>
</lang>
 
=={{header|Pike}}==
<langsyntaxhighlight lang="pike">import Stdio;
 
int main(){
Line 2,258 ⟶ 2,428:
write("I exist!\n");
}
}</langsyntaxhighlight>
 
=={{header|PL/I}}==
<langsyntaxhighlight lang="pli">*Process source or(!);
/*********************************************************************
* 20.10.2013 Walter Pachl
Line 2,282 ⟶ 2,451:
Close File(f);
Label: Put Skip List('File '!!xxx!!' not found');
End;</langsyntaxhighlight>
{{out}}
<pre>
Line 2,288 ⟶ 2,457:
File D:\_l\nix.txt not found
</pre>
 
=={{header|PL/M}}==
This sample assumes that the original 8080 PL/M compiler is used and that the program will be running under CP/M.
Line 2,294 ⟶ 2,462:
<br>Note that CP/M restricts file names to 7-bit ascii upper-case and not all non-letter, non-digit characters can be used.
<br>CP/M filenames are up to 8 characters long with an optional, up to three character extension.
<langsyntaxhighlight lang="plm">100H:
 
DECLARE FCB$SIZE LITERALLY '36';
Line 2,377 ⟶ 2,545:
CALL PRINT$NL;
 
EOF</langsyntaxhighlight>
{{out}}
Assuming there is no INPUT.TXT on the current drive, but there is one on D:.
Line 2,390 ⟶ 2,558:
Bdos Err on A: Select
</pre>
 
=={{header|Plain English}}==
{{libheader|Plain English-output}}
<syntaxhighlight lang="text">
To run:
Start up.
\ In the current working directory
Check that ".\input.txt" is in the file system.
Check that ".\docs\" is in the file system.
\ In the filesystem root
Check that "C:\input.txt" is in the file system.
Check that "C:\docs\" is in the file system.
Wait for the escape key.
Shut down.
 
To check that a path is in the file system:
If the path is in the file system, write the path then " exists" to the output; exit.
If the path is not in the file system, write the path then " does not exist" to the output; exit.
</syntaxhighlight>
 
=={{header|Pop11}}==
 
<langsyntaxhighlight lang="pop11">sys_file_exists('input.txt') =>
sys_file_exists('/input.txt') =>
sys_file_exists('docs') =>
sys_file_exists('/docs') =></langsyntaxhighlight>
 
Note that the above literally checks for existence. Namely sys_file_exists returns true if file exists but can not be read.
Line 2,402 ⟶ 2,589:
The only sure method to check if file can be read is to try to open it. If one just wants to check if file is readable the following may be useful:
 
<langsyntaxhighlight lang="pop11">;;; Define an auxilary function, returns boolean
define file_readable(fname);
lvars f = sysopen(fname, 0, true, `A`);
Line 2,411 ⟶ 2,598:
return (false);
endif;
enddefine;</langsyntaxhighlight>
 
The above works but is not the only way or the best way to check status of a file in Pop11. There is a very general procedure sys_file_stat that allows interrogation of a file or directory. The full documentation can be seen in the online documentation (search for sys_file_stat):
Line 2,423 ⟶ 2,610:
 
Users can easily define special cases of the general procedure.
 
=={{header|PowerShell}}==
 
<langsyntaxhighlight lang="powershell"> if (Test-Path -Path .\input.txt) {
write-host "File input exist"
}
else {
write-host "File input doesn't exist"
}</langsyntaxhighlight>
 
=={{header|Prolog}}==
 
{{works with|SWI-Prolog|6.6}}
 
<langsyntaxhighlight lang="prolog">
 
exists_file('input.txt'),
Line 2,445 ⟶ 2,630:
exists_directory('/docs').
 
</syntaxhighlight>
</lang>
 
=={{header|PureBasic}}==
<langsyntaxhighlight PureBasiclang="purebasic">result = ReadFile(#PB_Any, "input.txt")
If result>0 : Debug "this local file exists"
Else : Debug "result=" +Str(result) +" so this local file is missing"
Line 2,466 ⟶ 2,650:
If result>0 : Debug "this root directory exists"
Else : Debug "result=" +Str(result) +" so this root directory is missing"
EndIf </langsyntaxhighlight>
 
=={{header|Python}}==
 
<langsyntaxhighlight lang="python">import os
 
os.path.isfile("input.txt")
os.path.isfile("/input.txt")
os.path.isdir("docs")
os.path.isdir("/docs")</langsyntaxhighlight>
 
The more generic [https://docs.python.org/3/library/os.path.html#os.path.exists <code>os.path.exists(path)</code>] function will return True if the path exists, being it either a regular file or a directory.
 
=={{header|QB64}}==
<langsyntaxhighlight lang="qbasic">$NOPREFIX
PRINT DIREXISTS("docs")
PRINT DIREXISTS("\docs")
PRINT FILEEXISTS("input.txt")
PRINT FILEEXISTS("\input.txt")</langsyntaxhighlight>
 
=={{header|R}}==
<langsyntaxhighlight Rlang="r">file.exists("input.txt")
file.exists("/input.txt")
file.exists("docs")
Line 2,493 ⟶ 2,674:
 
# or
file.exists("input.txt", "/input.txt", "docs", "/docs")</langsyntaxhighlight>
 
The function <tt>file.exists</tt> returns a logical value (or a vector of logical values if more than one argument is passed)
Line 2,499 ⟶ 2,680:
This works with special names:
 
<langsyntaxhighlight Rlang="r">file.exists("`Abdu'l-Bahá.txt")</langsyntaxhighlight>
 
=={{header|Racket}}==
 
<syntaxhighlight lang="racket">
<lang Racket>
#lang racket
 
Line 2,518 ⟶ 2,698:
(and (file-exists? "input.txt")
(file-exists? "docs")))
</syntaxhighlight>
</lang>
 
=={{header|Raku}}==
(formerly Perl 6)
<syntaxhighlight lang="raku" line>
<lang perl6>
my $path = "/etc/passwd";
say $path.IO.e ?? "Exists" !! "Does not exist";
Line 2,531 ⟶ 2,710:
when :e { say "$path is neither a directory nor a file, but it does exist"; }
default { say "$path does not exist" }
}</langsyntaxhighlight>
 
<code>when</code> internally uses the smart match operator <code>~~</code>, so <code>when :e</code> really does <code>$given ~~ :e</code> instead of the method call <code>$given.e</code>; both test whether the file exists.
 
<syntaxhighlight lang="raku" line>
<lang perl6>
run ('touch', "♥ Unicode.txt");
 
say "♥ Unicode.txt".IO.e; # "True"
say "♥ Unicode.txt".IO ~~ :e; # same
</syntaxhighlight>
</lang>
 
=={{header|Raven}}==
 
<langsyntaxhighlight lang="raven">'input.txt' exists if 'input.txt exists' print
'/input.txt' exists if '/input.txt exists' print
'docs' isdir if 'docs exists and is a directory' print
'/docs' isdir if '/docs exists and is a directory' print</langsyntaxhighlight>
 
=={{header|REBOL}}==
<langsyntaxhighlight REBOLlang="rebol">exists? %input.txt
exists? %docs/
 
exists? %/input.txt
exists? %/docs/</langsyntaxhighlight>
 
=={{header|Red}}==
<langsyntaxhighlight Redlang="red">exists? %input.txt
exists? %docs/
exists? %/c/input.txt
Line 2,565 ⟶ 2,741:
 
>> exists? %`Abdu'l-Bahá.txt
== true</langsyntaxhighlight>
 
=={{header|REXX}}==
===version 1===
Line 2,572 ⟶ 2,747:
{{works with|Personal REXX}}
{{works with|Regina}}
<langsyntaxhighlight lang="rexx">/*REXX program creates a new empty file and directory in current directory and root dir.*/
fn= 'input.txt' /*default name of a file. */
dn= 'docs' /*default name of a directory (folder).*/
Line 2,594 ⟶ 2,769:
otherwise call doschdir '\' /*PC/REXX & Personal REXX version.*/
end /*select*/
end /*j*/ /*stick a fork in it, we're all done. */</langsyntaxhighlight>
 
===version 2===
{{works with|ARexx}}
{{works with|Regina 3.8 and later, with options: &nbsp; AREXX_BIFS &nbsp; AREXX_SEMANTICS}}
<langsyntaxhighlight lang="rexx">
/* Check if a file already exists */
filename='file.txt'
Line 2,608 ⟶ 2,783:
CALL Open(filehandle,filename,'APPEND')
RETURN 1
</syntaxhighlight>
</lang>
 
=={{header|Ring}}==
<langsyntaxhighlight lang="ring">
aFile = "C:\Ring\ReadMe.txt"
see aFile
if Fexists(aFile) see " exists" + nl
else see " doesn't exist" + nl ok
</syntaxhighlight>
</lang>
 
=={{header|RLaB}}==
 
RLaB provides two user functions for the task, ''isfile'' and ''isdir''.
<syntaxhighlight lang="rlab">
<lang RLaB>
>> isdir("docs")
0
>> isfile("input.txt")
0
</syntaxhighlight>
</lang>
=={{header|RPL}}==
The 2 functions below take a word as an argument and return a boolean stating the presence or not of a 'file' (a 'variable' in RPL jargon) or a directory corresponding to the word.
« VARS SWAP POS
» '<span style="color:blue">ISHERE?</span>' STO
« PATH HOME
VARS ROT POS
SWAP EVAL <span style="color:grey">@ Back to initial directory</span>
» '<span style="color:blue">ISHOME?</span>' STO
 
=={{header|Ruby}}==
<code>File.existsexist?</code> only checks if a file exists; it can be a regular file, a directory, or something else. <code>File.file?</code> or <code>File.directory?</code> checks for a regular file or a directory. Ruby also allows <code>FileTest.file?</code> or <code>FileTest.directory?</code>.
 
<langsyntaxhighlight lang="ruby">File.file?("input.txt")
File.file?("/input.txt")
File.directory?("docs")
File.directory?("/docs")</langsyntaxhighlight>
 
The next program runs all four checks and prints the results.
 
<langsyntaxhighlight lang="ruby">["input.txt", "/input.txt"].each { |f|
printf "%s is a regular file? %s\n", f, File.file?(f) }
["docs", "/docs"].each { |d|
printf "%s is a directory? %s\n", d, File.directory?(d) }</langsyntaxhighlight>
 
=={{header|Run BASIC}}==
<langsyntaxhighlight lang="runbasic">files #f,"input.txt"
if #f hasanswer() = 1 then print "File does not exist"
files #f,"docs"
if #f hasanswer() = 1 then print "File does not exist"
if #f isDir() = 0 then print "This is a directory"
</syntaxhighlight>
</lang>
 
=={{header|Rust}}==
<langsyntaxhighlight lang="rust">use std::fs;
 
fn main() {
Line 2,670 ⟶ 2,851:
}
}
</syntaxhighlight>
</lang>
 
=={{header|Scala}}==
{{libheader|Scala}}<langsyntaxhighlight lang="scala">import java.nio.file.{ Files, FileSystems }
 
object FileExistsTest extends App {
Line 2,689 ⟶ 2,869:
// main
List("output.txt", separator + "output.txt", "docs", separator + "docs" + separator).foreach(test)
}</langsyntaxhighlight>
 
=={{header|Scheme}}==
{{works with|Scheme|R6RS}}[http://www.r6rs.org/final/html/r6rs-lib/r6rs-lib-Z-H-10.html]
<syntaxhighlight lang ="scheme">(file-exists? filename)</langsyntaxhighlight>
 
=={{header|Seed7}}==
 
<langsyntaxhighlight lang="seed7">$ include "seed7_05.s7i";
 
const proc: main is func
Line 2,705 ⟶ 2,883:
writeln(fileType("docs") = FILE_DIR);
writeln(fileType("/docs") = FILE_DIR);
end func;</langsyntaxhighlight>
 
=={{header|SenseTalk}}==
<langsyntaxhighlight lang="sensetalk">
put file "input.txt" exists
put folder "docs" exists
Line 2,714 ⟶ 2,891:
put file "/input.txt" exists
put there is a folder "/docs"
</syntaxhighlight>
</lang>
 
=={{header|Sidef}}==
<langsyntaxhighlight lang="ruby"># Here
say (Dir.cwd + %f'input.txt' -> is_file);
say (Dir.cwd + %d'docs' -> is_dir);
Line 2,723 ⟶ 2,899:
# Root
say (Dir.root + %f'input.txt' -> is_file);
say (Dir.root + %d'docs' -> is_dir);</langsyntaxhighlight>
NOTE: To check only for existence, use the method ''exists''
 
=={{header|Slate}}==
<langsyntaxhighlight lang="slate">(File newNamed: 'input.txt') exists
(File newNamed: '/input.txt') exists
(Directory root / 'input.txt') exists
(Directory newNamed: 'docs') exists
(Directory newNamed: '/docs') exists</langsyntaxhighlight>
 
=={{header|Smalltalk}}==
 
[[Squeak]] has no notion of 'current directory' because it isn't tied to the shell that created it.
 
<langsyntaxhighlight lang="smalltalk">FileDirectory new fileExists: 'c:\serial'.
(FileDirectory on: 'c:\') directoryExists: 'docs'.</langsyntaxhighlight>
 
In [[GNU Smalltalk]] instead you can do:
 
<langsyntaxhighlight lang="smalltalk">(Directory name: 'docs') exists ifTrue: [ ... ]
(Directory name: 'c:\docs') exists ifTrue: [ ... ]
(File name: 'serial') isFile ifTrue: [ ... ]
(File name: 'c:\serial') isFile ifTrue: [ ... ]</langsyntaxhighlight>
 
Using ''exists'' in the third and fourth case will return true for directories too.
 
=={{header|Standard ML}}==
<langsyntaxhighlight lang="sml">OS.FileSys.access ("input.txt", []);
OS.FileSys.access ("docs", []);
OS.FileSys.access ("/input.txt", []);
OS.FileSys.access ("/docs", []);</langsyntaxhighlight>
 
=={{header|Stata}}==
Mata has functions to check the existence of files and directories:
<langsyntaxhighlight lang="stata">mata
fileexists("input.txt")
direxists("docs")
end</langsyntaxhighlight>
 
It's not as straightforward in Stata's macro language. For files, use [http://www.stata.com/help.cgi?confirm confirm]. Since it throws an error when the file does not exist, use [http://www.stata.com/help.cgi?capture capture] and check [http://www.stata.com/help.cgi?_variables _rc] afterwards.
 
<langsyntaxhighlight lang="stata">capture confirm file input.txt
if !_rc {
* do something if the file exists
}</langsyntaxhighlight>
 
It's not possible to check the existence of a directory with confirm. One may use the [https://ideas.repec.org/c/boc/bocode/s435507.html confirmdir] package from SSC. The confirmdir command saves the current directory, then tries to chdir to the directory to test (with capture to prevent an error). Then the value of _rc is put in a [http://www.stata.com/help.cgi?return stored result]. Example of use:
 
<langsyntaxhighlight lang="stata">confirmdir docs
if !`r(confirmdir)' {
* do something if the directory exists
}</langsyntaxhighlight>
 
The command works with special names, but one has to be careful: the name "`Abdu'l-Bahá.txt" contains a backquote, which is used to denote macros in Stata. So this character must be escaped with a backslash:
 
<langsyntaxhighlight lang="stata">confirm file "\`Abdu'l-Bahá.txt"</langsyntaxhighlight>
 
=={{header|Tcl}}==
Taking the meaning of the task from the DOS example: <!-- multiline “if” because of formatting -->
<langsyntaxhighlight lang="tcl">if { [file exists "input.txt"] } {
puts "input.txt exists"
}
Line 2,796 ⟶ 2,967:
if { [file isdirectory [file nativename "/docs"]] } {
puts "/docs exists and is a directory"
}</langsyntaxhighlight>
Note that these operations do not require the use of <tt>file nativename</tt> on either Windows or any version of Unix.
 
=={{header|Toka}}==
 
<langsyntaxhighlight lang="toka">[ "R" file.open dup 0 <> [ dup file.close ] ifTrue 0 <> ] is exists?
" input.txt" exists? .
" /input.txt" exists? .
" docs" exists? .
" /docs" exists? .</langsyntaxhighlight>
=={{header|True BASIC}}==
<syntaxhighlight lang="truebasic">SUB opener (a$)
WHEN EXCEPTION IN
OPEN #1: NAME f$
PRINT f$; " exists"
USE
PRINT f$; " not exists"
END WHEN
CLOSE #1
END SUB
 
LET f$ = "input.txt"
CALL opener (f$)
LET f$ = "\input.txt"
CALL opener (f$)
LET f$ = "docs\nul"
CALL opener (f$)
LET f$ = "\docs\nul"
CALL opener (f$)
 
LET f$ = "empty.tru"
CALL opener (f$)
LET f$ = "`Abdu'l-Bahá.txt"
CALL opener (f$)
END</syntaxhighlight>
=={{header|TUSCRIPT}}==
<langsyntaxhighlight lang="tuscript">
$$ MODE TUSCRIPT
file="input.txt",directory="docs"
Line 2,821 ⟶ 3,015:
PRINT/ERROR "directory ",directory," not exists"
ENDIF
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 2,827 ⟶ 3,021:
@@@@@@@@ directory docs not exists @@@@@@@@
</pre>
 
=={{header|UNIX Shell}}==
<langsyntaxhighlight lang="bash">test -f input.txt
test -f /input.txt
test -d docs
test -d /docs</langsyntaxhighlight>
 
The next program runs all four checks and prints the results.
 
<langsyntaxhighlight lang="bash">for f in input.txt /input.txt; do
test -f "$f" && r=true || r=false
echo "$f is a regular file? $r"
Line 2,843 ⟶ 3,036:
test -d "$d" && r=true || r=false
echo "$d is a directory? $r"
done</langsyntaxhighlight>
 
=={{header|Ursa}}==
The easiest way to do this in Ursa is to attempt to open the file in question. If it doesn't exist, an ioerror will be thrown.
<langsyntaxhighlight lang="ursa">def exists (string filename)
decl file f
try
Line 2,855 ⟶ 3,047:
return false
end try
end exists</langsyntaxhighlight>
 
=={{header|Vala}}==
This needs to be compiled with the gio-2.0 package: valac --pkg gio-2.0 check_that_file_exists.vala
<langsyntaxhighlight lang="vala">int main (string[] args) {
string[] files = {"input.txt", "docs", Path.DIR_SEPARATOR_S + "input.txt", Path.DIR_SEPARATOR_S + "docs"};
foreach (string f in files) {
Line 2,866 ⟶ 3,057:
}
return 0;
}</langsyntaxhighlight>
A more complete version which informs whether the existing file is a regular file or a directory
<langsyntaxhighlight lang="vala">int main (string[] args) {
string[] files = {"input.txt", "docs", Path.DIR_SEPARATOR_S + "input.txt", Path.DIR_SEPARATOR_S + "docs"};
foreach (var f in files) {
Line 2,887 ⟶ 3,078:
}
return 0;
}</langsyntaxhighlight>
 
=={{header|VBA}}==
 
<syntaxhighlight lang="vb">
<lang vb>
Option Explicit
 
Line 2,910 ⟶ 3,100:
End If
End Function
</syntaxhighlight>
</lang>
 
=={{header|VBScript}}==
 
<langsyntaxhighlight lang="vbscript">Set FSO = CreateObject("Scripting.FileSystemObject")
 
Function FileExists(strFile)
Line 2,949 ⟶ 3,138:
 
 
</syntaxhighlight>
</lang>
 
=={{header|Vedit macro language}}==
Vedit allows using either '\' or '/' as directory separator character, it is automatically converted to the one used by the operating system.
<langsyntaxhighlight lang="vedit">// In current directory
if (File_Exist("input.txt")) { M("input.txt exists\n") } else { M("input.txt does not exist\n") }
if (File_Exist("docs/nul", NOERR)) { M("docs exists\n") } else { M("docs does not exist\n") }
Line 2,959 ⟶ 3,147:
// In the root directory
if (File_Exist("/input.txt")) { M("/input.txt exists\n") } else { M("/input.txt does not exist\n") }
if (File_Exist("/docs/nul", NOERR)) { M("/docs exists\n") } else { M("/docs does not exist\n") }</langsyntaxhighlight>
 
=={{header|Visual Basic}}==
{{works with|Visual Basic|VB6 Standard}}
The proposed solutions for VBA and VBScript work in VB6 as well, however here's a Windows API based approach:
<syntaxhighlight lang="vb">
<lang vb>
'declarations:
Public Declare Function GetFileAttributes Lib "kernel32" _
Line 2,981 ⟶ 3,168:
End If
End Function
</syntaxhighlight>
</lang>
 
=={{header|Visual Basic .NET}}==
'''Platform:''' [[.NET]]
 
{{works with|Visual Basic .NET|9.0+}}
<langsyntaxhighlight lang="vbnet">'Current Directory
Console.WriteLine(If(IO.Directory.Exists("docs"), "directory exists", "directory doesn't exists"))
Console.WriteLine(If(IO.Directory.Exists("output.txt"), "file exists", "file doesn't exists"))
Line 2,999 ⟶ 3,185:
"directory exists", "directory doesn't exists"))
Console.WriteLine(If(IO.Directory.Exists(IO.Path.DirectorySeparatorChar & "output.txt"), _
"file exists", "file doesn't exists"))</langsyntaxhighlight>
=={{header|V (Vlang)}}==
 
<syntaxhighlight lang="go">// Check file exists in V
=={{header|Vlang}}==
<lang go>// Check file exists in V
// Tectonics: v run check-that-file-exists.v
module main
Line 3,030 ⟶ 3,215:
_ := os.execute('touch $efn')
println('os.is_file("$wfn"): ${os.is_file(wfn)}')
}</langsyntaxhighlight>
 
{{out}}
Line 3,040 ⟶ 3,225:
os.is_file('empty.txt'): true
os.is_file("`Abdu'l-Bahá.txt"): true</pre>
 
 
=={{header|Wren}}==
Line 3,048 ⟶ 3,232:
 
Since in Linux an ''empty'' directory has a size of 4K bytes, we check the number of files it contains to confirm that it's empty.
<langsyntaxhighlight ecmascriptlang="wren">import "io" for Directory, File
 
for (name in ["input.txt", "`Abdu'l-Bahá.txt"]) {
Line 3,065 ⟶ 3,249:
} else {
System.print("%(dir) directory does not exist.")
}</langsyntaxhighlight>
 
{{out}}
Line 3,074 ⟶ 3,258:
</pre>
 
=={{header|XPL0}}==
Attempting to open a non-existent file or directory will cause an error.
A zero-length file is detected as existing.
<syntaxhighlight lang="xpl0">
int FD; \file descriptor
[Trap(false); \prevent errors from aborting program
FD:= FOpen("input.txt", 0);
if GetErr then Text(0, "input.txt doesn't exist^m^j");
FD:= FOpen("dir", 0);
if GetErr then Text(0, "dir doesn't exist^m^j");
FD:= FOpen("/input.txt", 0);
if GetErr then Text(0, "/input.txt doesn't exist^m^j");
FD:= FOpen("/dir", 0);
if GetErr then Text(0, "/dir doesn't exist^m^j");
]</syntaxhighlight>
=={{header|Yabasic}}==
<langsyntaxhighlight Yabasiclang="yabasic">open "foo.bar" for writing as #1
print #1 "Hallo !"
close #1
Line 3,081 ⟶ 3,280:
close #1
if (not open(1,"buzz.bar")) print "Could not open 'buzz.bar' for reading"
</syntaxhighlight>
</lang>
 
=={{header|zkl}}==
<langsyntaxhighlight lang="zkl">File.exists("input.txt") //--> True (in this case a sym link)
File.exists("/input.txt") //-->False
File.isDir("/") //-->True
File.isDir("docs") //-->False
</syntaxhighlight>
</lang>
 
{{omit from|Befunge|No filesystem support}}
{{omit from|EasyLang}}
{{omit from|HTML}}
{{omit from|Scratch|No filesystem support}}
885

edits