https://github.com/webcaetano/filename-to-dir
Use filenames to create folders schema
https://github.com/webcaetano/filename-to-dir
Last synced: 6 months ago
JSON representation
Use filenames to create folders schema
- Host: GitHub
- URL: https://github.com/webcaetano/filename-to-dir
- Owner: webcaetano
- License: mit
- Created: 2017-02-22T11:04:49.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-22T11:33:40.000Z (over 9 years ago)
- Last Synced: 2025-01-30T19:18:10.999Z (over 1 year ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# filename-to-dir
[![NPM version][npm-image]][npm-url]
[![Build status][travis-image]][travis-url]
> Use filenames to create folders schema.
## Installation
```
npm install filename-to-dir --save
```
## Usage
```
namedir(glob,dest,options,callback)
```
## Example
```javascript
var namedir = require('filename-to-dir');
namedir('**/*.png','./destFolder',function(){
});
// this
// heroes_$_lulu_$_hit_$_001.png
// heroes_$_lulu_$_hit_$_002.png
// heroes_$_janna_$_walk_$_001.png
// return
// destFolder/heroes/lulu/hit/001.png
// destFolder/heroes/lulu/hit/002.png
// destFolder/heroes/janna/walk/001.png
// or
namedir(['**/*.png'],'./destFolder',{split:'@'},function(){
});
// with all options
namedir(['**/*.png'],'./destFolder',{split:'@'},function(err,data){
});
```
## Options
Option
Description
Default
split
Split string.
_$_
## CLI
```
npm install filename-to-dir -g
```
```
Usage
$ namedir
Options
--split Split string. Default: "_$_"
Examples
namedir "**/*.png"
namedir "**/*.png" destFolder/
namedir "**/*.png" "destFolder/" --split "@"
```
## Check Also
[flatten-dirname](https://github.com/webcaetano/flatten-dirname)
## License
MIT
[npm-image]: https://img.shields.io/npm/v/filename-to-dir.svg?style=flat-square
[npm-url]: https://npmjs.org/package/filename-to-dir
[travis-image]: https://img.shields.io/travis/webcaetano/filename-to-dir.svg?style=flat-square
[travis-url]: https://travis-ci.org/webcaetano/filename-to-dir