Skip to content

Commit 65eeffa

Browse files
committed
ready to publish
0 parents  commit 65eeffa

File tree

6 files changed

+849
-0
lines changed

6 files changed

+849
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# keep projects ide agnostic
2+
*.sublime-project
3+
*.sublime-workspace
4+
5+
# Dependency directories
6+
node_modules/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2019-Present William Grant
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# SortiFiler CLI
2+
3+
> Get your files sorted from the command line. 📚🗂🖥
4+
5+
## Description
6+
An opinionated command line interface to sort your files and folders easily while feeling like [Hackerman](https://knowyourmeme.com/memes/hackerman).
7+
8+
**Desktop app coming soon! 🚀**
9+
10+
Everyday you look at your *Desktop/Downloads* folder and think, "Damn I need to clean up this mess". 🤦
11+
12+
That feeling is why this CLI now exists. 😆
13+
14+
SortiFiler classifies files and folders and moves them into *\_Type* folders for easy access at the root of your chosen directory. 🗃
15+
16+
## Installation
17+
18+
To install SortiFiler CLI enter `npm -g install sortifiler-cli` into your terminal.
19+
20+
If you are looking for the SortiFiler API then check out [SortiFiler](https://github.com/yougotwill/sortifiler)!
21+
22+
## Usage
23+
24+
```bash
25+
sortifiler --help
26+
27+
Usage
28+
$ sortfiler <path>
29+
30+
Options
31+
--meta, -m Includes meta files when sorting.
32+
--files, -f Sort all files in a given path.
33+
--folders, -F Sort all folders in a given path
34+
no flags, Sorts all files and folders in a given path.
35+
36+
<path> is the file path to directory that needs sorting
37+
38+
Examples
39+
Sort all files and folders in the Downloads folder.
40+
$ sortifiler ~/Downloads
41+
Sorting ...
42+
Sorted ✔
43+
44+
Sort all files on the Desktop
45+
$ sortifiler ~/Desktop --files
46+
Sorting files ...
47+
Sorted ✔
48+
49+
Sort all folders in the Downloads folder
50+
$ sortifiler ~/Downloads --folders
51+
Sorting folders ...
52+
Sorted ✔
53+
54+
Sort all folders and meta files in the current directory
55+
$ sortifiler . --folders --meta
56+
Looking for meta files ...
57+
Sorting folders ...
58+
Sorted ✔
59+
```
60+
61+
## How does the sorting work?
62+
63+
- Folders are classified using the best matching *_Type* folder based on the files within that folder (only 1 level down).
64+
- Files are classified as follows:
65+
66+
| _Type Folder | File Extension |
67+
| :------------- | :--------------------------------------- |
68+
| _Books | ".epub", ".mobi" |
69+
| _Documents | ".pdf", ".txt", ".doc", ".docx", ".ppt", ".pptx", ".md", ".json", ".ods", ".log", ".xls", ".xlsx", ".ttf" |
70+
| _Images | ".png", ".jpg", ".jpeg", ".gif", ".xcf", ".stl", ".blend", "*.obj", "*.mtl", "*.3ds", "*.tga", ".icns" |
71+
| _Music | ".mp3", ".wav", ".flac", ".m4a", ".ogg", ".mid", ".asd", ".m3u", ".pls", ".alp", ".asx", ".bfxrsound", ".m3u8", ".als", ".m4r" |
72+
| _Programs | ".dmg", ".exe", ".sh", ".app", ".pkg", ".apk", ".ipa", ".gba", ".gbc" |
73+
| _Scripts | ".py", ".java", ".class", ".sh", "*.cs", "*.r", ".itermcolors", ".terminal", ".theme", ".gbaskin", ".tmtheme", ".resbackup" |
74+
| _Torrents | ".torrent" |
75+
| _Videos | ".mkv", ".mp4", ".mov", ".mpeg", ".webm", ".srt", ".avi" |
76+
| _Web | ".html", ".css", ".js", ".htm" |
77+
| _Zipped | ".zip", ".rar", ".7z", ".tar.gz", ".tar", ".gz", "*.unitypackage", "*.prefab", ".fbx" |
78+
79+
- **Note:** This list maybe outdated please check out [SortiFiler](https://github.com/yougotwill/sortifiler) for the latest info.
80+
81+
## Development
82+
83+
### Contributing
84+
85+
1. Fork it
86+
2. Create your feature branch: `git checkout -b feature/my-new-feature`
87+
3. Commit your changes: `git commit -am 'Add some feature'`
88+
4. Push to the branch: `git push origin feature/my-new-feature`
89+
5. Submit a pull request
90+
91+
### Requirements / Dependencies
92+
93+
- npm
94+
95+
## Version
96+
97+
0.1.0
98+
99+
## License
100+
101+
[MIT](LICENSE)

cli.js

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#! /usr/bin/env node
2+
'use strict';
3+
4+
const meow = require('meow');
5+
const sortifiler = require('sortifiler');
6+
7+
const cli = meow(`
8+
Usage
9+
$ sortfiler <path>
10+
11+
Options
12+
--meta, -m Includes meta files when sorting.
13+
--files, -f Sort all files in a given path.
14+
--folders, -F Sort all folders in a given path
15+
no flags, Sorts all files and folders in a given path.
16+
17+
<path> is the file path to directory that needs sorting
18+
19+
Examples
20+
Sort all files and folders in the Downloads folder.
21+
$ sortifiler ~/Downloads
22+
Sorting ...
23+
Sorted ✔
24+
25+
Sort all files on the Desktop
26+
$ sortifiler ~/Desktop --files
27+
Sorting files ...
28+
Sorted ✔
29+
30+
Sort all folders in the Downloads folder
31+
$ sortifiler ~/Downloads --folders
32+
Sorting folders ...
33+
Sorted ✔
34+
35+
Sort all folders and meta files in the current directory
36+
$ sortifiler . --folders --meta
37+
Looking for meta files ...
38+
Sorting folders ...
39+
Sorted ✔
40+
`, {
41+
flags: {
42+
help: {
43+
type: 'boolean',
44+
alias: 'h'
45+
},
46+
version: {
47+
type: 'boolean',
48+
alias: 'v'
49+
},
50+
meta: {
51+
type: 'boolean',
52+
alias: 'm'
53+
},
54+
files: {
55+
type: 'boolean',
56+
alias: 'f'
57+
},
58+
folders: {
59+
type: 'boolean',
60+
alias: 'F'
61+
}
62+
}
63+
});
64+
65+
const flags = cli.unnormalizedFlags;
66+
let metaFiles = false;
67+
if (flags.meta || flags.m) {
68+
metaFiles = true;
69+
console.log('Looking for meta files ...');
70+
}
71+
if (flags.files || flags.f) {
72+
console.log('Sorting files ...');
73+
sortifiler.sortFiles(cli.input[0], metaFiles);
74+
} else if (flags.folders || flags.F) {
75+
console.log('Sorting folders ...');
76+
sortifiler.sortFolders(cli.input[0], metaFiles);
77+
} else {
78+
console.log('Sorting ...');
79+
sortifiler.sortAll(cli.input[0], metaFiles);
80+
}
81+
82+
console.log('Sorted ✔');

0 commit comments

Comments
 (0)