PyFilesystem API¶
The following is a complete list of methods on PyFilesystem objects.
appendbytes()Append bytes to a file.appendtext()Append text to a file.check()Check if a filesystem is open or raise error.close()Close the filesystem.copy()Copy a file to another location.copydir()Copy a directory to another location.create()Create or truncate a file.desc()Get a description of a resource.download()Copy a file on the filesystem to a file-like object.exists()Check if a path exists.filterdir()Iterate resources, filtering by wildcard(s).getbasic()Get basic info namespace for a resource.getdetails()Get details info namespace for a resource.getinfo()Get info regarding a file or directory.getmeta()Get meta information for a resource.getmodified()Get the last modified time of a resource.getospath()Get path with encoding expected by the OS.getsize()Get the size of a file.getsyspath()Get the system path of a resource, if one exists.gettype()Get the type of a resource.geturl()Get a URL to a resource, if one exists.hassyspath()Check if a resource maps to the OS filesystem.hash()Get the hash of a file’s contents.hasurl()Check if a resource has a URL.isclosed()Check if the filesystem is closed.isempty()Check if a directory is empty.isdir()Check if path maps to a directory.isfile()Check if path maps to a file.islink()Check if path is a link.listdir()Get a list of resources in a directory.lock()Get a thread lock context manager.makedir()Make a directory.makedirs()Make a directory and intermediate directories.match()Match one or more wildcard patterns against a path.move()Move a file to another location.movedir()Move a directory to another location.open()Open a file on the filesystem.openbin()Open a binary file.opendir()Get a filesystem object for a directory.readbytes()Read file as bytes.readtext()Read file as text.remove()Remove a file.removedir()Remove a directory.removetree()Recursively remove file and directories.scandir()Scan files and directories.setinfo()Set resource information.settimes()Set modified times for a resource.touch()Create a file or update times.tree()Render a tree view of the filesystem.upload()Copy a binary file to the filesystem.validatepath()Check a path is valid and return normalized path.writebytes()Write a file as bytes.writefile()Write a file-like object to the filesystem.writetext()Write a file as text.