FileInfoの man ページによると、stat()
Go でファイルを ing するときに次の情報が利用可能です。
type FileInfo interface {
Name() string // base name of the file
Size() int64 // length in bytes for regular files; system-dependent for others
Mode() FileMode // file mode bits
ModTime() time.Time // modification time
IsDir() bool // abbreviation for Mode().IsDir()
Sys() interface{} // underlying data source (can return nil)
}
Goで特定のファイルへのハードリンクの数を取得するにはどうすればよいですか?
UNIX ( <sys/stat.h>
) では、st_nlink
(「ハード リンクの参照カウント」) をstat()
システム コールからの戻り値として定義しています。