SSFS: A Virtual Filesystem to Organize Files by Extension

SSFS is a virtual filesystem that organizes file by their extensions (eg.: .c, .py, .png,…). It provides a simple way to see the various types of files present, and easy bulk deletion of file types. It is built using the FUSE interface and overrides Unix filesystem calls.

struct fuse_operations ss_ops = {
    .getattr = ss_getattr,
    .readdir = ss_readdir,
    .open = ss_open,
    .read = ss_read,
    .write = ss_write,
    .unlink = ss_unlink,
    .opendir = ss_opendir,
    .rmdir = ss_rmdir,
    .truncate = ss_truncate,
    .ftruncate = ss_ftruncate,
};

SSFS is a 2 level filesystem. The root contains folders, each representing an extension found. Each folder contains the files with that extension. Directories and files without extensions are ignored.

While mounting, one must specify a mount point, and a directory to be scanned. The names of the files in the virtual filesystem are replaced with the full path of the file.

2017-04-23-185638_1366x768_scrot

Terminal View

] are used as forward slashes are not allowed in file names.

2017-04-23-185654_1366x768_scrot

Filesystem in a file browser: 1) The actual directory being scanned. 2) SSFS root. 3) Inside +c folder.

Source code available on GitHub.

#fuse, #unix-filesystem

Advertisements