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.
- 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.
- Nodejs
- Typescript
- Chokidar
- Inquiror
Clone the repository:
git clone [email protected]:Joshibbotson/cli-folder-organiser.git
cd into repository:
cd cli-folder-organiser
docker-compose run --rm cli-folder-organiser
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.
Existing Rules, heres one I made earlier, we'll be adding an extra one:
Stats for nerds, heres some of the stats of that rule you just saw:
First select add rule, then type out your chosen rule name:
Enter the directory path we want to watch for file changes, note how cli-folder-organiser checks if the path exists or not:
Input any extensions you want to target, here we use .png as screenshots are saved as .png:
Input any strings you want to target, here we want to target the key word 'Screenshot':
In this case as we only have one key word, either ALL or ANY will work:
Here we can specify to match by Both the keyword 'Screenshot' and .png
Specify the directory to output our target files, note cli-folder-organiser will validate against using the same input directory here:
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:
We've toggled recursive here and we will also toggle yes the rule is active, inactive rules will not be used.
That's it the rule is made, now we can check it exists:
Now lets run it by selecting 'Start Folder Organiser':