Skip to content

Instantly share code, notes, and snippets.

@eriknomitch
Last active May 30, 2022 08:13
Show Gist options
  • Save eriknomitch/39df74fb66fef860c207 to your computer and use it in GitHub Desktop.
Save eriknomitch/39df74fb66fef860c207 to your computer and use it in GitHub Desktop.
"Circular File System" Concept

Circular File System Concept

Description

A filesystem (most likely virtual via FUSE) where:

1.) A directory index contains a list of all the (unique) directories and subdirectories in the tree. Example:

~/example
  ./images
  ./mockups
  ./screencasts

2.) Entering one of the sub-directories will narrow down the files/directories.

~/example/mockups
  images-Homepage.psd
  ./images
  Mockups.ppt

~/example/mockups/images
  Homepage.psd
  
~/example/screencasts/images
  Background.psd

3.) Those files also exist in any other subdirectory which is part of the path and be prefixed accordingly.

~/example/images
  mockups-Homepage.psd
  ./mockups
  screencasts-Background.psd
  ./screencasts

~/example/screencasts
  images-Background.psd
  ./images
  Screencast.mov

Thus the contents of ~/examples/images/screencasts == ~/examples/screencasts/images.

Why?

Efficient Overviews

It's inefficient to go digging through sub directories if you have a layout such as this and just want to look at "all images".

~/foo
  ./screencasts/images
  ./images

Instead of inspecting each directory, you could simply see "all images" at ./images.

Efficient/Ambiguous Directory Changes

Instead of remembering "my 'screencast image files' are located at ./screencasts/images" you could change directory into either ./screencasts/images or ./images/screencasts.

Author

Concept by Erik Nomitch

@nevesnunes
Copy link

A fun concept, but it can be accomplished with simpler primitives, perhaps wrapped in shell functions. For example, with this hierarchy:

mkdir -p ~/a/b/c
echo 1 > ~/a/b/c/1
echo 2 > ~/a/c/2

Efficient overviews:

find ~/a -path '*/c/*'

Ambiguous directory changes:

cd "$(find ~/a -path '*/c/b' -o -path '*/b/c')"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment