An open API service indexing awesome lists of open source software.

https://github.com/webcaetano/flatten-dirname

Flatten files to from relative folders. But keep dirname on filename.
https://github.com/webcaetano/flatten-dirname

Last synced: 6 months ago
JSON representation

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

Awesome Lists containing this project

README

          

# flatten-dirname

[![NPM version][npm-image]][npm-url]
[![Build status][travis-image]][travis-url]

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

## Installation

```
npm install flatten-dirname --save
```

## Usage

```
fdname(glob,dest,options,callback)
```

## Example

```javascript
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

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

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

## Check Also

[filename-to-dir](https://github.com/webcaetano/filename-to-dir)

## License

MIT

[npm-image]: https://img.shields.io/npm/v/flatten-dirname.svg?style=flat-square
[npm-url]: https://npmjs.org/package/flatten-dirname
[travis-image]: https://img.shields.io/travis/webcaetano/flatten-dirname.svg?style=flat-square
[travis-url]: https://travis-ci.org/webcaetano/flatten-dirname