flatten-dirname

1.0.2 • Public • Published

flatten-dirname

NPM version Build status

Flatten files to from relative folders. But keep dirname on filename.

Installation

npm install flatten-dirname --save

Usage

fdname(glob,dest,options,callback)

Example

var fdname = require('flatten-dirname');
 
 
fdname('**/*.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
fdname(['**/*.png'],'./destFolder',{split:'@'},function(){
 
});
 
// with all options
fdname(['**/*.png'],'./destFolder',{split:'@'},function(err,data){
 
});

Options

Option Description Default
split Split string. _$_

CLI

npm install flatten-dirname -g
Usage
    $ fdname <glob> <dest>

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

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

Check Also

filename-to-dir

License

MIT

Package Sidebar

Install

npm i flatten-dirname

Weekly Downloads

1

Version

1.0.2

License

MIT

Last publish

Collaborators

  • webcaetano