Skip to content

Commit

Permalink
ready to publish
Browse files Browse the repository at this point in the history
  • Loading branch information
yougotwill committed Dec 28, 2019
0 parents commit 65eeffa
Show file tree
Hide file tree
Showing 6 changed files with 849 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# keep projects ide agnostic
*.sublime-project
*.sublime-workspace

# Dependency directories
node_modules/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2019-Present William Grant

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
101 changes: 101 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# SortiFiler CLI

> Get your files sorted from the command line. 📚🗂🖥
## Description
An opinionated command line interface to sort your files and folders easily while feeling like [Hackerman](https://knowyourmeme.com/memes/hackerman).

**Desktop app coming soon! 🚀**

Everyday you look at your *Desktop/Downloads* folder and think, "Damn I need to clean up this mess". 🤦

That feeling is why this CLI now exists. 😆

SortiFiler classifies files and folders and moves them into *\_Type* folders for easy access at the root of your chosen directory. 🗃

## Installation

To install SortiFiler CLI enter `npm -g install sortifiler-cli` into your terminal.

If you are looking for the SortiFiler API then check out [SortiFiler](https://github.com/yougotwill/sortifiler)!

## Usage

```bash
sortifiler --help

Usage
$ sortfiler <path>

Options
--meta, -m Includes meta files when sorting.
--files, -f Sort all files in a given path.
--folders, -F Sort all folders in a given path
no flags, Sorts all files and folders in a given path.

<path> is the file path to directory that needs sorting

Examples
Sort all files and folders in the Downloads folder.
$ sortifiler ~/Downloads
Sorting ...
Sorted ✔

Sort all files on the Desktop
$ sortifiler ~/Desktop --files
Sorting files ...
Sorted ✔

Sort all folders in the Downloads folder
$ sortifiler ~/Downloads --folders
Sorting folders ...
Sorted ✔

Sort all folders and meta files in the current directory
$ sortifiler . --folders --meta
Looking for meta files ...
Sorting folders ...
Sorted ✔
```

## How does the sorting work?

- Folders are classified using the best matching *_Type* folder based on the files within that folder (only 1 level down).
- Files are classified as follows:

| _Type Folder | File Extension |
| :------------- | :--------------------------------------- |
| _Books | ".epub", ".mobi" |
| _Documents | ".pdf", ".txt", ".doc", ".docx", ".ppt", ".pptx", ".md", ".json", ".ods", ".log", ".xls", ".xlsx", ".ttf" |
| _Images | ".png", ".jpg", ".jpeg", ".gif", ".xcf", ".stl", ".blend", "*.obj", "*.mtl", "*.3ds", "*.tga", ".icns" |
| _Music | ".mp3", ".wav", ".flac", ".m4a", ".ogg", ".mid", ".asd", ".m3u", ".pls", ".alp", ".asx", ".bfxrsound", ".m3u8", ".als", ".m4r" |
| _Programs | ".dmg", ".exe", ".sh", ".app", ".pkg", ".apk", ".ipa", ".gba", ".gbc" |
| _Scripts | ".py", ".java", ".class", ".sh", "*.cs", "*.r", ".itermcolors", ".terminal", ".theme", ".gbaskin", ".tmtheme", ".resbackup" |
| _Torrents | ".torrent" |
| _Videos | ".mkv", ".mp4", ".mov", ".mpeg", ".webm", ".srt", ".avi" |
| _Web | ".html", ".css", ".js", ".htm" |
| _Zipped | ".zip", ".rar", ".7z", ".tar.gz", ".tar", ".gz", "*.unitypackage", "*.prefab", ".fbx" |

- **Note:** This list maybe outdated please check out [SortiFiler](https://github.com/yougotwill/sortifiler) for the latest info.

## Development

### Contributing

1. Fork it
2. Create your feature branch: `git checkout -b feature/my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin feature/my-new-feature`
5. Submit a pull request

### Requirements / Dependencies

- npm

## Version

0.1.0

## License

[MIT](LICENSE)
82 changes: 82 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#! /usr/bin/env node
'use strict';

const meow = require('meow');
const sortifiler = require('sortifiler');

const cli = meow(`
Usage
$ sortfiler <path>
Options
--meta, -m Includes meta files when sorting.
--files, -f Sort all files in a given path.
--folders, -F Sort all folders in a given path
no flags, Sorts all files and folders in a given path.
<path> is the file path to directory that needs sorting
Examples
Sort all files and folders in the Downloads folder.
$ sortifiler ~/Downloads
Sorting ...
Sorted ✔
Sort all files on the Desktop
$ sortifiler ~/Desktop --files
Sorting files ...
Sorted ✔
Sort all folders in the Downloads folder
$ sortifiler ~/Downloads --folders
Sorting folders ...
Sorted ✔
Sort all folders and meta files in the current directory
$ sortifiler . --folders --meta
Looking for meta files ...
Sorting folders ...
Sorted ✔
`, {
flags: {
help: {
type: 'boolean',
alias: 'h'
},
version: {
type: 'boolean',
alias: 'v'
},
meta: {
type: 'boolean',
alias: 'm'
},
files: {
type: 'boolean',
alias: 'f'
},
folders: {
type: 'boolean',
alias: 'F'
}
}
});

const flags = cli.unnormalizedFlags;
let metaFiles = false;
if (flags.meta || flags.m) {
metaFiles = true;
console.log('Looking for meta files ...');
}
if (flags.files || flags.f) {
console.log('Sorting files ...');
sortifiler.sortFiles(cli.input[0], metaFiles);
} else if (flags.folders || flags.F) {
console.log('Sorting folders ...');
sortifiler.sortFolders(cli.input[0], metaFiles);
} else {
console.log('Sorting ...');
sortifiler.sortAll(cli.input[0], metaFiles);
}

console.log('Sorted ✔');
Loading

0 comments on commit 65eeffa

Please sign in to comment.