# pydoc > genericpath

---
type: CommandReference
command: genericpath
mode: pydoc
section: ""
source: pydoc3
---

## Quick Reference

- `exists(path)` — Test whether a path exists
- `isfile(path)` — Test whether a path is a regular file
- `isdir(path)` — Return true if the pathname refers to an existing directory
- `getsize(path)` — Return the size of a file
- `getmtime(path)` — Return the last modification time of a file
- `getatime(path)` — Return the last access time of a file
- `commonprefix(list)` — Return the longest common leading component of pathnames
- `samefile(path1, path2)` — Test whether two pathnames reference the same file or directory

## Name

**genericpath** — Path operations common to more than one OS. Do not use directly; the OS-specific modules import the appropriate functions from this module themselves.

## Synopsis

This module is a helper for `posixpath`, `ntpath`, and other OS-specific path modules. It is not intended to be imported directly by user code.

## Options

- `commonprefix(list)` — Given a list of pathnames, returns the longest common leading component.
- `exists(path)` — Test whether a path exists. Returns `False` for broken symbolic links.
- `getatime(path)` — Return the last access time of a file, reported by `os.stat()`.
- `getctime(path)` — Return the metadata change time of a file, reported by `os.stat()`.
- `getmtime(path)` — Return the last modification time of a file, reported by `os.stat()`.
- `getsize(path)` — Return the size of a file, reported by `os.stat()`.
- `isdir(path)` — Return `True` if the pathname refers to an existing directory.
- `isfile(path)` — Test whether a path is a regular file.
- `samefile(path1, path2)` — Test whether two pathnames reference the same actual file or directory. This is determined by the device number and i-node number and raises an exception if an `os.stat()` call on either pathname fails.
- `sameopenfile(fp1, fp2)` — Test whether two open file objects reference the same file.
- `samestat(stat1, stat2)` — Test whether two stat buffers reference the same file.

## See Also

- [Python genericpath documentation](https://docs.python.org/3.10/library/genericpath.html)
- [os.path](https://docs.python.org/3.10/library/os.path.html)
- [posixpath](https://docs.python.org/3.10/library/posixpath.html)
- [ntpath](https://docs.python.org/3.10/library/ntpath.html)

## Exit Codes

Not applicable (module, not a command).