{"repo":"PyFilesystem/pyfilesystem2","free":true,"listed":false,"github":"https://github.com/PyFilesystem/pyfilesystem2","clone":"git clone https://github.com/PyFilesystem/pyfilesystem2.git","description":"Python's Filesystem abstraction layer","language":"Python","stars":2105,"topics":["filesystem","pyfilesystem","pyfilesystem2","python","ftp","tar","zip","filesystem-library"],"license":"MIT","category":"dev-tools","readme_excerpt":"PyFilesystem2 Python's Filesystem abstraction layer. Documentation - Wiki (currently offline) - API Documentation - GitHub Repository - Blog Introduction Think of PyFilesystem's FS objects as the next logical step to Python's file objects. In the same way that file objects abstract a single file, FS objects abstract an entire filesystem. Let's look at a simple piece of code as an example. The following function uses the PyFilesystem API to count the number of non-blank lines of Python code in a directory. It works recursively , so it will find .py files in all sub-directories. We can call count python loc as follows: The line project fs = open fs(' /projects') opens an FS object that maps to the projects directory in your home folder. That object is used by count python loc when counting lines of code. To count the lines of Python code in a zip file , we can make the following change: Or to count the Python lines on an FTP server: No changes to count python loc are necessary, because PyFileystem provides a simple consistent interface to anything that resembles a collection of files and directories. Essentially, it allows you to write code that is independent of where and how the files are physically stored. Contrast that with a version that purely uses the standard library: This version is similar to the PyFilesystem code above, but would only work with the OS filesystem. Any other filesystem would require an entirely different API, and you would likely have to re-implement t","default_branch":null,"files":null,"tree":[],"storefront":"/r/PyFilesystem","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/PyFilesystem/pyfilesystem2/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}