https://github.com/nswbmw/node-category
  
  
    Files/Directorys categorization tool. 
    https://github.com/nswbmw/node-category
  
        Last synced: about 2 months ago 
        JSON representation
    
Files/Directorys categorization tool.
- Host: GitHub
 - URL: https://github.com/nswbmw/node-category
 - Owner: nswbmw
 - Created: 2015-05-04T07:04:21.000Z (over 10 years ago)
 - Default Branch: master
 - Last Pushed: 2015-05-04T07:04:48.000Z (over 10 years ago)
 - Last Synced: 2025-08-20T17:24:28.391Z (3 months ago)
 - Language: JavaScript
 - Size: 1.28 MB
 - Stars: 5
 - Watchers: 2
 - Forks: 1
 - Open Issues: 0
 - 
            Metadata Files:
            
- Readme: README.md
 
 
Awesome Lists containing this project
README
          ## category
Files/Directorys categorization tool.
### Install
    npm i category -g
### Usage
```
$ category -h
  Usage: category  
  Files/Directorys categorization tool.
  Options:
    -h, --help             output usage information
    -V, --version          output the version number
    -i, --input [regexp]   regexp of file to category (required)
    -o, --output [regexp]  regexp of dir to generate (required)
    -f, --force            whether to delete original file
  Example:
    $ category -i "^IMG_(\d{4})(\d{2})(\d{2})_\d{6}(\.jpg)?$" -o "$1-$2-$3" -f ./test ./test
```
### Example
```
$ category -i "^IMG_(\d{4})(\d{2})(\d{2})_\d{6}(\.jpg)?$" -o "$1-$2-$3" -f ./test ./test
```
before:
```
test/
├── IMG_20150425_133502.jpg
├── IMG_20150426_134524.jpg
├── IMG_20150427_123602.jpg
├── IMG_20150427_221603.jpg
└── IMG_20150427_221604/
```
after:
```
test/
├── 2015-04-25/
│   └── IMG_20150425_133502.jpg
├── 2015-04-26/
│   └── IMG_20150426_134524.jpg
└── 2015-04-27/
    ├── IMG_20150427_123602.jpg
    ├── IMG_20150427_221603.jpg
    └── IMG_20150427_221604/ 
```
### Personal usage
```
category -i '^(IMG|VID)_(\d{4})(\d{2})(\d{2})_\d{6}(\.(jpg|mp4))?$' -o '$2—$3—$4' -f ./Camera ./Camera
```
### Test
    npm test
### License
MIT