# move-unused-path

> Reliably move to an unused path.

Latest version **2.0.2** (published 2025-10-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install move-unused-path
pnpm add move-unused-path
yarn add move-unused-path
bun add move-unused-path
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2025-10-26 |
| First published | 2019-10-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | fabiospampinato |
| Keywords | move, unused, path |

## Links

- npm: https://www.npmjs.com/package/move-unused-path
- Repository: https://github.com/fabiospampinato/move-unused-path
- Homepage: https://github.com/fabiospampinato/move-unused-path#readme
- Issues: https://github.com/fabiospampinato/move-unused-path/issues
- npm.io page: https://npm.io/package/move-unused-path

## Dependencies (1)

- [get-unused-path](https://npm.io/package/get-unused-path.md) ^2.0.3

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 2.0.2 (latest) — 2025-10-26
- 2.0.1 — 2024-04-04
- 2.0.0 — 2022-11-07
- 1.4.0 — 2020-07-04
- 1.3.2 — 2020-03-17
- 1.3.1 — 2020-03-17
- 1.3.0 — 2020-01-21
- 1.2.0 — 2020-01-21
- 1.1.1 — 2020-01-14
- 1.1.0 — 2020-01-14
- 1.0.2 — 2019-10-10
- 1.0.1 — 2019-10-10
- 1.0.0 — 2019-10-10

## README

# Move Unused Path

Reliably move to an unused path.

It is basically a wrapper around [get-unused-path](https://github.com/fabiospampinato/get-unused-path) which doesn't just return an unused path, but also moves to it.

## Install

```sh
npm install move-unused-path
```

## Usage

```ts
import fs from 'fs';
import moveUnusedPath from 'move-unused-path';

// Let's move a file to an unused path

const sourceFilePath = '/x/y/z/bar.txt';

const result = await moveUnusedPath ( sourceFilePath, {
  fileName: 'foo.txt',
  folderPath: '/x/y/z',
  // incrementer: ( name, ext, attempt ) => attempt > 1 ? `${name}-${attempt}${ext}` : `${name}${ext}`,
  // maxTries: 1_000
});

result.folderPath; // => '/x/y/z'
result.filePath; // => '/x/y/z/foo (3).txt'
result.fileName; // => 'foo (3).txt'

// Let's check that the file got actually moved

console.log ( fs.existsSync ( sourceFilePath ) ); // => false
console.log ( fs.existsSync ( result.filePath ) ); // => true
```

## Related

- [unused-path](https://github.com/fabiospampinato/unused-path): Reliably get an unused path and copy/move/write to it.
- [copy-unused-path](https://github.com/fabiospampinato/copy-unused-path): Reliably copy to an unused path.
- [get-unused-path](https://github.com/fabiospampinato/get-unused-path): Reliably get an unused path you can write to.
- [write-unused-path](https://github.com/fabiospampinato/write-unused-path): Reliably write to an unused path.

## License

MIT © Fabio Spampinato

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