根据FileInfo 的手册页,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()
系统调用的返回值。