@flemist/copy-glob-flat
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

NPM Version NPM Downloads Build Status Test Coverage

Copy files to single directory with auto rename duplicates

Installation

npm i @flemist/copy-glob-flat

Usage CLI

cp-flat <SOURCE_GLOB1> <SOURCE_GLOB2> ... <DEST_DIR>
cp-flat src/**/*.txt !**/ignore.txt tmp/destDir

Usage module

import {copyGlobFlat} from '@flemist/copy-glob-flat'

/*
Initial:

/source
  /dir
    /dir1
      file.txt
      ignore.txt
    /dir2
      file.txt
      ignore.txt
    file.txt
    ignore.txt
  file.txt
  ignore.txt
/dest
  /file2.txt
    file.txt
  file1.txt
*/

await copyGlobFlat({
  destDir: 'tmp',
  globs: [
    '**/*.txt',
    '**/!ignore.txt',
  ],
})

/*
Result:

/source
  ...
/dest
  /file2.txt
    file.txt
  file.txt   - copied from source/file
  file0.txt  - copied from source/dir/file
  file1.txt
  file3.txt  - copied from source/dir/dir1/file
  file4.txt  - copied from source/dir/dir2/file
*/

Package Sidebar

Install

npm i @flemist/copy-glob-flat

Weekly Downloads

1

Version

0.0.5

License

ISC

Unpacked Size

7.25 kB

Total Files

10

Last publish

Collaborators

  • nikolay_makhonin