Skip to content

Modern Fs LinkCount

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

Home › Filesystem › Filesystem Library › LinkCount

LinkCount

Returns how many hard links, or names, a file has.

Syntax

LinkCount( p )

Notes

  • FsResultULong

Examples

#import "std/fs"
using fs

dim td as FsResultUStr = CreateTempDir( "fbdoc" )
dim as ustring dir_ = td.Value( )
dim as ustring p = PathJoin( dir_, "f.txt" )
WriteAllText( p, "hello" )

'' How many hard links -- names -- this file has. One for an ordinary
'' file.
dim r as FsResultULong = LinkCount( p )

print r.IsOk( )              '' true
print r.Value( )             '' 1

'' A count above 1 means deleting this name does NOT free the data, and
'' that writing through one name changes what the others see

RemoveDirAll( dir_ )

Library: Filesystem Library
Category: Filesystem
Documented under: Links And Permissions

Clone this wiki locally