# filestosql

> Recursively Crawl files in a folder and generate SQL script to easily load the file list to a MySQL database

Latest version **1.0.0** (published 2019-02-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install filestosql
pnpm add filestosql
yarn add filestosql
bun add filestosql
```

Provides the command `filestosql`.

## 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 | 2019-02-24 |
| First published | 2019-02-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Darwin Biler |
| Maintainers | buonzz |
| Keywords | cdn, storage, volume, stats |

## Links

- npm: https://www.npmjs.com/package/filestosql
- Repository: https://github.com/buonzz/filestosql
- Homepage: https://github.com/buonzz/filestosql#readme
- Issues: https://github.com/buonzz/filestosql/issues
- npm.io page: https://npm.io/package/filestosql

## Dependencies (4)

- [walk](https://npm.io/package/walk.md) ^2.3.14
- [winston](https://npm.io/package/winston.md) ^3.0.0
- [commander](https://npm.io/package/commander.md) ^2.19.0
- [sqlstring](https://npm.io/package/sqlstring.md) ^2.3.1

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2019-02-24

## README

# Files to SQL

A ClI (command line interface) tool to get a listing of all files inside a folder (and its subfolders) and generate a SQL file so you can easily analyze it using standard SQL queries.


### Usage


Install it
```
npm install -g filestosql
```

run it

```
filestosql --folder=/path/to/folder/to/crawl --output=path/to/sql/file.sql
```

after it had run, you can now load the sql file to your database

```
mysql -u user -p  dbname -h localhost < path/to/sql/file.sql
```

make sure you the following scheme in your mysql database

```
CREATE TABLE IF NOT EXISTS files (
    id INT AUTO_INCREMENT,
    filename VARCHAR(255) NOT NULL,
    filepath VARCHAR(500) NOT NULL,
    dirname VARCHAR(255) NOT NULL,
    extension VARCHAR(255) NOT NULL,
    content_hash VARCHAR(255) DEFAULT NULL,
    content_size VARCHAR(255) DEFAULT NULL,
    file_type VARCHAR(50) DEFAULT NULL,
    tags TEXT DEFAULT NULL,
    last_indexed BIGINT DEFAULT NULL,
    UNIQUE KEY unique_filepath (filepath),
    PRIMARY KEY (id)
)  ENGINE=INNODB;
```

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