Skip to content

Modern Fs SameFile

Paul Squires edited this page Oct 19, 2026 · 2 revisions

Home › Filesystem › Filesystem Library › SameFile

SameFile

Returns whether two paths name the same file; fails if either is missing.

Syntax

SameFile( a, b )

Notes

  • Whether a and b are the same file, following links on both.
  • A path that does not exist is a failure (FS_NOT_FOUND), not false: "different files" and "could not tell" are different answers.

Examples

#import "std/fs"
#import "std/chrono"
using fs

dim as ustring dir_ = CreateTempDir( "tkdoc" ).Value( )
dim as ustring p = PathJoin( dir_, "f.txt" )
WriteAllText( p, "x" )
CopyFile( p, PathJoin( dir_, "copy.txt" ) )
print SameFile( p, PathJoin( dir_, "copy.txt" ) ).Value( )    '' false -- a copy is another file
print SameFile( p, p ).Value( )                                '' true

RemoveDirAll( dir_ )

Library: Filesystem Library Category: Filesystem Documented under: Metadata

Clone this wiki locally