filename-to-dir

1.0.0 • Public • Published

filename-to-dir

NPM version Build status

Use filenames to create folders schema.

Installation

npm install filename-to-dir --save

Usage

namedir(glob,dest,options,callback)

Example

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 <glob> <dest>

Options
    --split Split string. Default: "_$_"

Examples
    namedir "**/*.png"
    namedir "**/*.png" destFolder/
    namedir "**/*.png" "destFolder/" --split "@"

Check Also

flatten-dirname

License

MIT

Package Sidebar

Install

npm i filename-to-dir

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • webcaetano