pg.io.FileSystem
Accessible via pg.io.FileSystem.
-
class FileSystem[source]
Bases: object
Interface for a file system.
Methods:
chmod(path, mode)
|
Changes the permission of a file. |
copy(oldpath, newpath)
|
Copies a file to a new path. |
exists(path)
|
Returns True if a path exists. |
getctime(path)
|
Returns the creation time of a file. |
getmtime(path)
|
Returns the last modification time of a file. |
glob(pattern)
|
Lists all files or sub-directories. |
isdir(path)
|
Returns True if a path is a directory. |
listdir(path)
|
Lists all files or sub-directories. |
mkdir(path[, mode])
|
Makes a directory based on a path. |
mkdirs(path[, mode, exist_ok])
|
Makes a directory chain based on a path. |
open(path[, mode])
|
Opens a file with a path. |
rename(oldpath, newpath)
|
Renames a file based on a path. |
rm(path)
|
Removes a file based on a path. |
rmdir(path)
|
Removes a directory based on a path. |
rmdirs(path)
|
Removes a directory chain based on a path. |
-
abstract chmod(path, mode)[source]
Changes the permission of a file.
- Return type:
None
-
abstract copy(oldpath, newpath)[source]
Copies a file to a new path.
- Return type:
None
-
abstract exists(path)[source]
Returns True if a path exists.
- Return type:
bool
-
abstract getctime(path)[source]
Returns the creation time of a file.
- Return type:
float
-
abstract getmtime(path)[source]
Returns the last modification time of a file.
- Return type:
float
-
abstract glob(pattern)[source]
Lists all files or sub-directories.
- Return type:
list[str]
-
abstract isdir(path)[source]
Returns True if a path is a directory.
- Return type:
bool
-
abstract listdir(path)[source]
Lists all files or sub-directories.
- Return type:
list[str]
-
abstract mkdir(path, mode=511)[source]
Makes a directory based on a path.
- Return type:
None
-
abstract mkdirs(path, mode=511, exist_ok=True)[source]
Makes a directory chain based on a path.
- Return type:
None
-
abstract open(path, mode='r', **kwargs)[source]
Opens a file with a path.
- Return type:
pg.io.File
-
abstract rename(oldpath, newpath)[source]
Renames a file based on a path.
- Return type:
None
-
abstract rm(path)[source]
Removes a file based on a path.
- Return type:
None
-
abstract rmdir(path)[source]
Removes a directory based on a path.
- Return type:
bool
-
abstract rmdirs(path)[source]
Removes a directory chain based on a path.
- Return type:
None