Categories instead of directories. A tool for convenient file storage.

Inspired by the article

“Categories Instead of Directories, or A Semantic File System for Linux Vitis,”

I decided to create my own version of the utility vitis for PowerShell Core.

Why I started doing this

First, vitis only for Linux.
Secondly, I want to use 'pipes' in PowerShell.

Since I wanted to create a cross-platform utility, I chose .Net Core.

Background

At first, there was chaos. Then folders appeared on the disk.
But chaos still reigned. Tags, sub-tags, and tag synonyms emerged. But chaos took them as well. And categories were devised.

Concept

Files are stored not in a hierarchy of folders, but in a 'heap', with specific categories. A single file can belong to multiple categories.

If you need to find a file, it's easier to enter the categories it belongs to. This is much easier to remember than which folders it is stored in.

However, such a file system is by no means suitable for storing code, sources, etc.
It is intended for storing, for example, family photos, music, documents.

Using

Well then, let's proceed to the demonstration.

Let's install Graphile:

# install.ps1 находится в корневой папке с кодом
PS D:SourcereposGraphile> .install.ps1

First, initialize Graphile in the folder:

# Импортируем установленный модуль
PS C:UsersDellGraphileTest> Import-Module GraphilePowerShell
# Инициализируем Graphile в папке
PS C:UsersDellGraphileTest> Init-Graphile
C:UsersDellGraphileTestgraphile.db

So, we've set everything up. Now we can create a new category:

PS C:UsersDellGraphileTest> New-Category -Name "music"
music

Let's add files:

PS C:UsersDellGraphileTest> Get-ChildItem "D:MusicPink Floyd - The Wall" -Recurse -Filter "*.mp3" | foreach { $_.FullName } | foreach {
>> Add-FileToCategory -File $_ -Categories "music"
>> }

For those who didn’t understand what I did:

  1. I obtained a list of files in the folder Pink Floyd - The Wall
  2. Converted each file to its full path
  3. Added each file to the category music

Now let’s check if we really added the files to the category:

PS C:UsersDellGraphileTest> List-Graphiles | Format-Table

A list will be displayed in the format:

Categories Names Id Categories Name Extension

Let’s add more categories and files:

New-Category -Name "the-wall"
New-Category -Name "alan-parsons"

List-Graphiles -Categories "music" | foreach { Add-GraphileToCategory -Categories "the-wall" -Files $_.Name }

Get-ChildItem "D:MusicThe Alan Parsons Project - Turn of a Friendly Card" -File -Recurse | foreach { $_.FullName } | foreach { Add-FileToCategory -File $_ -Categories "music", "alan-parsons" }

Let’s check the files:

List-Graphiles -Categories "alan-parsons" | Format-Table

The command will display all files that belong to the category alan-parsons.

More files for the god of file systems!

New-Category -Name "images"
Get-ChildItem "D:Images" -File -Recurse | foreach { $.FullName } | foreach {
    Add-FileToCategory -File $_ -Categories "images"
}

Checking:

List-Graphiles -Categories "images" | Format-Table

It all works!

But this is just the beginning. Export your usual file system to Graphile and achieve excellent file organization.

Where to download Graphile

Here link on GitLab for Graphile.

License MIT, so you can even use it for commercial purposes.

The future of the project

Since this is PowerShell, not just any lightweight option, you can create a graphical interface for .NET Core.

How to do this:

  1. Install the Microsoft.PowerShell.SDK package
  2. Use the PowerShell class and invoke Graphile.

If you liked the project, please make commits, merge request.and create discussions.

Thank you for reading! Enjoy using it!

Source: habr.com

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster