Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
2bc1f8f0
Commit
2bc1f8f0
authored
Jul 24, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added getsize(), getmtime(), getatime()
parent
89a79d19
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
0 deletions
+72
-0
Lib/dospath.py
Lib/dospath.py
+18
-0
Lib/macpath.py
Lib/macpath.py
+18
-0
Lib/ntpath.py
Lib/ntpath.py
+18
-0
Lib/posixpath.py
Lib/posixpath.py
+18
-0
No files found.
Lib/dospath.py
View file @
2bc1f8f0
...
...
@@ -124,6 +124,24 @@ def commonprefix(m):
return
prefix
# Get size, mtime, atime of files.
def
getsize
(
filename
):
"""Return the size of a file, reported by os.stat()."""
st
=
os
.
stat
(
filename
)
return
st
[
stat
.
ST_SIZE
]
def
getmtime
(
filename
):
"""Return the last modification time of a file, reported by os.stat()."""
st
=
os
.
stat
(
filename
)
return
st
[
stat
.
ST_MTIME
]
def
getatime
(
filename
):
"""Return the last access time of a file, reported by os.stat()."""
st
=
os
.
stat
(
filename
)
return
st
[
stat
.
ST_MTIME
]
# Is a path a symbolic link?
# This will always return false on systems where posix.lstat doesn't exist.
...
...
Lib/macpath.py
View file @
2bc1f8f0
...
...
@@ -99,6 +99,24 @@ def isdir(s):
return
S_ISDIR
(
st
[
ST_MODE
])
# Get size, mtime, atime of files.
def
getsize
(
filename
):
"""Return the size of a file, reported by os.stat()."""
st
=
os
.
stat
(
filename
)
return
st
[
stat
.
ST_SIZE
]
def
getmtime
(
filename
):
"""Return the last modification time of a file, reported by os.stat()."""
st
=
os
.
stat
(
filename
)
return
st
[
stat
.
ST_MTIME
]
def
getatime
(
filename
):
"""Return the last access time of a file, reported by os.stat()."""
st
=
os
.
stat
(
filename
)
return
st
[
stat
.
ST_MTIME
]
# Return true if the pathname refers to a symbolic link.
# (Always false on the Mac, until we understand Aliases.)
...
...
Lib/ntpath.py
View file @
2bc1f8f0
...
...
@@ -143,6 +143,24 @@ def commonprefix(m):
return
prefix
# Get size, mtime, atime of files.
def
getsize
(
filename
):
"""Return the size of a file, reported by os.stat()."""
st
=
os
.
stat
(
filename
)
return
st
[
stat
.
ST_SIZE
]
def
getmtime
(
filename
):
"""Return the last modification time of a file, reported by os.stat()."""
st
=
os
.
stat
(
filename
)
return
st
[
stat
.
ST_MTIME
]
def
getatime
(
filename
):
"""Return the last access time of a file, reported by os.stat()."""
st
=
os
.
stat
(
filename
)
return
st
[
stat
.
ST_MTIME
]
# Is a path a symbolic link?
# This will always return false on systems where posix.lstat doesn't exist.
...
...
Lib/posixpath.py
View file @
2bc1f8f0
...
...
@@ -128,6 +128,24 @@ def commonprefix(m):
return
prefix
# Get size, mtime, atime of files.
def
getsize
(
filename
):
"""Return the size of a file, reported by os.stat()."""
st
=
os
.
stat
(
filename
)
return
st
[
stat
.
ST_SIZE
]
def
getmtime
(
filename
):
"""Return the last modification time of a file, reported by os.stat()."""
st
=
os
.
stat
(
filename
)
return
st
[
stat
.
ST_MTIME
]
def
getatime
(
filename
):
"""Return the last access time of a file, reported by os.stat()."""
st
=
os
.
stat
(
filename
)
return
st
[
stat
.
ST_MTIME
]
# Is a path a symbolic link?
# This will always return false on systems where os.lstat doesn't exist.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment