pc.files works on the computer’s filesystem. A path is absolute, may use
environment variables such as %USERPROFILE%, and a relative path is taken from
the user’s home folder.
A read or write is at most 32 MiB.
C:\ax holds the session’s own software
and is read-only, except C:\ax\downloads.files.read_bytes() and files.read_text()
TargetNotFoundError when the file doesn’t exist; InvalidArgsError
for a folder or a file over 32 MiB.
files.write_bytes() and files.write_text()
Write a file, creating its folders. With append=True, add to the end instead
of replacing it.
FileInfo for the written file. Raises
InvalidArgsError for a path under C:\ax other than C:\ax\downloads, or
over 32 MiB.
files.upload() and files.download()
Copy a local file onto the computer, or a file from the computer to a local path.
files.list()
A folder’s entries, at most 10,000.
list[FileInfo].
files.stat() and files.exists()
stat raises TargetNotFoundError when nothing is there; exists returns False.
files.mkdir()
Create a folder and any missing parents.
FileInfo.
files.delete()
Delete a file or folder. A folder that isn’t empty needs recursive=True.
FileInfo
| Field | Type | Description |
|---|---|---|
name | str | The file or folder name. |
path | str | Its full path. |
is_dir | bool | Whether it is a folder. |
size | int | Size in bytes. |
modified_ms | int | Last modified, epoch milliseconds. |