None of them lets you work with files and paths in an elegant way. By elegant I mean as jQuery lets you work with DOM. A jQuery for filesystem is not a new idea, though: someone has written fsquery library for Node.js. There is a good pyFileSystem library that supports different file systems (like ssh, memory, ftp).
I rather needed a path traversing tool than filesystem.
Let’s say, I want to find photos (*.jp[e]g) in my pictures folders for 2010 and 2011. The folders for those days end with 'repairs'.
from fsquass import Fs
photos = Fs('/home/siberiano/Pictures/{2011,2010} *repairs *.jp?g:ignorecase')
Note how syntax is similar to what we’re used to in file systems:
Now I can proceed, say, find the folders of these files:
photos.parents().find('*.txt')
photos.filter('DCIM*')
As you can see, it’s quite similar to jQuery. But unlike jQuery, Python’s set classes support set operations:
photos.parents().children() - photos
Everything you can do with set, you can do with Fs objects as well.
Clone it and install with setuptools:
hg clone https://bitbucket.org/siberiano/fsquass
cd fsquass
python setup.py install