copy-files-rev v1.0.3
copy-files-rev
Copy files and folders to a wanted destination.
This is the next generation of copy-files-tree package
Getting Started
To install package using npm
npm install --save copy-files-revOr with yarn
yarn add copy-files-revHow to use?
Sync usage:
import {copyFilesSync} from 'copy-files-rev'
const error = copyFilesSync(FoldersData);Async usage:
import {copyFiles} from 'copy-files-rev'
(async () => {
const error = await copyFiles(FoldersData);
})()Props
FoldersData<Object>Key<String>Folder source pathValue<Object>Folder datafoldersAndFiles<Array>Of<String>should contain the folders/files names you want to copy from theKeypathdestination<String>Destination folder pathoptions<Object>This field is optionalallFiles<boolean>Defaultfalse, use true in case you want to copy all the files in theKeypathallDirectories<boolean>Defaultfalse, use true in case you want to copy all the folders in theKeypath
Example:
import {copyFiles} from 'copy-files-rev'
const FoldersData = {
'/Users/user1/folder-name-1': {
foldersAndFiles: ['image.png', 'inner-folder-name1'],
destination: '/Users/user1/some-folder-name',
},
'/Users/user2/folder-name-2': {
options: {
allFiles: true, // Folder files [`file-name1.txt`, `file-name2.txt`]
},
destination: '/Users/user2/some-folder-name2'
}
}
(async () => {
const error = await copyFiles(FoldersData);
})()Files Structure
/Users/ ----- |
- user1 --- folder-name-1 ---
| |
| - 'image.png'
| |
| - 'inner-folder-name1' // With all the inner files and folders
|
|
- user2 --- folder-name-2 ---
|
- `file-name1.txt`
|
- `file-name2.txt`
Donations
Please don't hesitate to donate this package, and reaching me out.
License
This project is licensed under the MIT License - see the LICENSE.md file for details