# filename-to-dir

> Use filenames to create folders schema

Latest version **1.0.0** (published 2017-02-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install filename-to-dir
pnpm add filename-to-dir
yarn add filename-to-dir
bun add filename-to-dir
```

Provides the command `namedir`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-02-22 |
| First published | 2017-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Andre Caetano |
| Maintainers | webcaetano |
| Keywords | cli-app, cli, flatten, dirname, filename, mv, copy, file, files, fs, glob, file-system |

## Links

- npm: https://www.npmjs.com/package/filename-to-dir
- Repository: https://github.com/webcaetano/filename-to-dir
- Homepage: https://github.com/webcaetano/filename-to-dir#readme
- Issues: https://github.com/webcaetano/filename-to-dir/issues
- npm.io page: https://npm.io/package/filename-to-dir

## Dependencies (6)

- [glob](https://npm.io/package/glob.md) ^7.1.1
- [meow](https://npm.io/package/meow.md) ^3.7.0
- [async](https://npm.io/package/async.md) ^2.1.2
- [lodash](https://npm.io/package/lodash.md) ^4.13.1
- [cp-file](https://npm.io/package/cp-file.md) ^4.1.1
- [escape-string-regexp](https://npm.io/package/escape-string-regexp.md) ^1.0.5

## Recent versions

- 1.0.0 (latest) — 2017-02-22

## README

# filename-to-dir

[![NPM version][npm-image]][npm-url]
[![Build status][travis-image]][travis-url]
<!-- [![Test coverage][coveralls-image]][coveralls-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


<table>
<tr>
<td><strong>Option</strong></td>
<td width="300"><strong>Description</strong></td>
<td><strong>Default</strong></td>
</tr>
<tr>
<td><code>split</code></td>
<td>Split string.</td>
<td><code>_$_</code></td>
</tr>
</table>


## 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](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
<!-- [coveralls-image]: https://img.shields.io/coveralls/blakeembrey/filename-to-dir.svg?style=flat 
[coveralls-url]: https://coveralls.io/r/blakeembrey/filename-to-dir?branch=master
-->

---
_Source: https://npm.io/package/filename-to-dir · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
