Skip to content

Commit b669a80

Browse files
FIX: Use st_birthtime for 'created' field in LocalFileSystem.info() (#1883)
Co-authored-by: Martin Durant <[email protected]>
1 parent 0ddc423 commit b669a80

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fsspec/implementations/local.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,15 @@ def info(self, path, **kwargs):
109109
t = "file"
110110
else:
111111
t = "other"
112+
113+
# Check for the 'st_birthtime' attribute, which is not always present; fallback to st_ctime
114+
created_time = getattr(out, "st_birthtime", out.st_ctime)
115+
112116
result = {
113117
"name": path,
114118
"size": size,
115119
"type": t,
116-
"created": out.st_ctime,
120+
"created": created_time,
117121
"islink": link,
118122
}
119123
for field in ["mode", "uid", "gid", "mtime", "ino", "nlink"]:

0 commit comments

Comments
 (0)