Added new listfiles.py which is adapted from permissions.py, so there could be some copypasta.
Updated permissions to use the real ternary (can't believe how long it took me to discover that), and fixed a bug.