Skip to content

Joshibbotson/cli-folder-organiser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Why Cli Folder Organiser

My Downloads folder was getting painful to say the least. I thought I'd exercise some of the nodejs skills I'd picked up at my job and write a cli app where anyone can add rules to monitor directories and move files about.

What does it do?

  • Watches chosen directories and moves files that match user made rule sets.
  • Enables users to create their own rule sets and saves them into a lightweight rules.json file.
  • Tracks statistics for how many files are moved by a rule.

Tech stack used:

  • Nodejs
  • Typescript

Libraries used:

  • Chokidar
  • Inquiror

Getting started:

Clone the repository:

git clone [email protected]:Joshibbotson/cli-folder-organiser.git

cd into repository:

cd cli-folder-organiser

Optional: Docker compose up to test cli-folder-organiser out in a contained environment

docker-compose run --rm cli-folder-organiser

To use cli-folder-organiser on your local system:

Install dependencies:

npm install

Start cli-folder-organiser:

npm run start

You're all set! Everything else is self explantory, however, see below for a step by step guide on how add rules and what each menu option does.

The main menu:
Screenshot 2024-04-28 at 16 09 53

Existing Rules, heres one I made earlier, we'll be adding an extra one: Screenshot 2024-04-28 at 16 10 02

Stats for nerds, heres some of the stats of that rule you just saw: Screenshot 2024-04-28 at 16 10 17

First select add rule, then type out your chosen rule name: Screenshot 2024-04-28 at 16 10 54

Enter the directory path we want to watch for file changes, note how cli-folder-organiser checks if the path exists or not: Screenshot 2024-04-28 at 16 11 08 Screenshot 2024-04-28 at 16 11 15

Input any extensions you want to target, here we use .png as screenshots are saved as .png: Screenshot 2024-04-28 at 16 11 22

Input any strings you want to target, here we want to target the key word 'Screenshot': Screenshot 2024-04-28 at 16 11 29

In this case as we only have one key word, either ALL or ANY will work: Screenshot 2024-04-28 at 16 11 33

Here we can specify to match by Both the keyword 'Screenshot' and .png Screenshot 2024-04-28 at 16 11 35

Specify the directory to output our target files, note cli-folder-organiser will validate against using the same input directory here: Screenshot 2024-04-28 at 16 11 48 Screenshot 2024-04-28 at 16 11 56

Optionally we can choose to ignore directories so anything in these directories won't be processed against the rule, this is particularly useful if we utilise a recursive rule, not again cli-folder-orgainserwill validate against using a directory that is not a sub directory: Screenshot 2024-04-28 at 16 12 25 Screenshot 2024-04-28 at 16 12 48

We've toggled recursive here and we will also toggle yes the rule is active, inactive rules will not be used. Screenshot 2024-04-28 at 16 13 04

That's it the rule is made, now we can check it exists: Screenshot 2024-04-28 at 16 13 11 Screenshot 2024-04-28 at 16 14 26 Screenshot 2024-04-28 at 16 14 39

Now lets run it by selecting 'Start Folder Organiser': Screenshot 2024-04-28 at 16 17 58

Here's a gif of it in action, lovely:
2024-04-2816-17-08-ezgif com-video-to-gif-converter

And we can check it's updated stats: Screenshot 2024-04-28 at 16 18 09

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published