# grunt-smart_copy

> Task to synchronize two directories. Similar to grunt-copy but updates only files that have been changed. Additional option to override read only files based on .

Latest version **0.1.1** (published 2014-08-05) · 0 weekly downloads

## Install

```sh
npm install grunt-smart_copy
pnpm add grunt-smart_copy
yarn add grunt-smart_copy
bun add grunt-smart_copy
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2014-08-05 |
| First published | 2014-07-31 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Daniell0gda |
| Maintainers | daniell0gda |
| Keywords | gruntplugin, sync, synchronize, copy, readOnly, permissions |

## Links

- npm: https://www.npmjs.com/package/grunt-smart_copy
- Repository: https://github.com/daniell0gda/grunt-smart_copy
- Issues: https://github.com/daniell0gda/grunt-smart_copy/issues
- npm.io page: https://npm.io/package/grunt-smart_copy

## Dependencies (1)

- [promised-io](https://npm.io/package/promised-io.md) 0.3.3

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 0.1.1 (latest) — 2014-08-05
- 0.1.0 — 2014-08-05
- 0.1.7 — 2014-08-05
- 0.1.6 — 2014-07-31
- 0.1.5 — 2014-07-31
- 0.1.4 — 2014-07-31

## README

# grunt-smart_copy

> Task to synchronize two directories. Similar to grunt-copy but updates only files that have been changed. Additional option to modify file permissions, a la `chmod`.

## Getting Started
This plugin requires Grunt `~0.4.5`

If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

```shell
npm install grunt-smart_copy --save-dev
```

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

```js
grunt.loadNpmTasks('grunt-smart_copy');
```

## The "grunt-smart_copy" task

### Overview
In your project's Gruntfile, add a section named `smart_copy` to the data object passed into `grunt.initConfig()`.

```js
grunt.initConfig({
        smart_copy {
            main: {
                files: [{
                    cwd: 'src',
                    src: [
                        '**', /* Include everything */
                        '!**/*.txt' /* but exclude txt files */
                    ],
                    dest: 'bin',
                }],
                writeCode: 666 // Overrite code
            }
        }

    },
});

```

### Options

#### options.mode
Type: `Int`
Default value: _none_ (required)

A string value to specify the permissions' [numeric mode](http://ss64.com/bash/chmod.html) to set on the files and/or directories, e.g.:
 - `'755'`
 - `'644'`
 - `'400'`

## More examples
```javascript
smart_copy: {
    main: {
        files: [{
                src: ['path/**'], // includes files in path and its subdirs
                dest: 'dest/'
            }, 
            {
                cwd: 'path/',  // makes all src relative to cwd
                src: ['**/*.js', '**/*.css'],
                dest: 'dest/'
            },
        ]
    }
}

```

```javascript
smart_copy: {
    main: {
        files: [{
            cwd: 'c:/source',
            src: ['**', '!Bin/**', 'config ', '! * .log '],
            dest: 'd:/dest'
        }],
        writeCode: 666 // Overrite code
    }
}
```

### Warnings
 - On Windows (tested with Windows 8), the only possible values seem to be `'666'`(read/write for all users) or `'444'` (read
   only for all users). Whatever number is set in the user column (the hundreds place value) will become the value for all
   columns (user, group, and other), e.g. `'400'` becomes `'444'`.  The default permissons for both newly created files and
   folders is `'666'`.

## Task based on:
[grunt-chmod](https://www.npmjs.org/package/grunt-chmod) and [grunt-sync](https://www.npmjs.org/package/grunt-sync)

## Release History
_(Nothing yet)_

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