0.0.5 • Published 2 years ago

@flemist/copy-glob-flat v0.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

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
*/
0.0.5

2 years ago

0.0.4

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago