Manage a directory in a parent filesystem.
A sub-directory on a parent filesystem.
A SubFS is a filesystem object that maps to a sub-directory of another filesystem. This is the object that is returned by
Create a filesystem. See help(type(self)) for accurate signature.
Get the proxied filesystem.
This method should return a filesystem for methods not associated with a path, e.g.
A version of
SubFSwhich closes its parent when closed.
Close the filesystem and release any resources.
It is important to call this method when you have finished working with the filesystem. Some filesystems may not finalize changes until they are closed (archives for example). You may call this method explicitly (it is safe to call close multiple times), or you can use the filesystem as a context manager to automatically close.
>>> with OSFS('~/Desktop') as desktop_fs: ... desktop_fs.writetext( ... 'note.txt', ... "Don't forget to tape Game of Thrones" ... )
If you attempt to use a filesystem that has been closed, a
FilesystemClosedexception will be thrown.