Comments (4)
With rsync everything is included by default. You choose what to exclude from that, while overriding specific excludes with some includes. Afaiu this is the pattern that's enabled by having includes come before excludes when we build the rsync command.
There's been some discussion about this before #16
Not sure why you're setting the src
directory to .
when you only want to copy the contents of webroot
? Could some variation on options like this do what you're after?
options: {
recursive: true,
src: "webroot/",
exclude: ["scss"],
dryRun: true,
dest: "/path/to/files",
host: "[email protected]",
}
I might be misunderstanding though! Let me know how you get on, will be happy to merge your PR if it genuinely scratches an itch.
from rsyncwrapper.
So my real problem is that I have:
base
|-- bower_components
|-- config
|-- node_modules
|-- tmp
|-- vendor
+-- webroot
|-- scss
+-- img
I want to copy config, webroot, and vendor folders but nothing else.
I could write this as
rsync base dest --exclude=tmp/ --exclude=node_modules/ --exclude=bower_components/ --exclude=webroot/scss/
But then I have to always maintain a list of what I don't want. If I add a secrets
folder and forget about this it will be transferred by deafult.
I can do this as three separate rsync operations:
rsync base/config dest/config
rsync base/vendor dest/config
rsync base/webroot dest/webroot --exclude=scss/
which may be a fine solution in my case but doesn't scale.
I don't really understand all the intricacies of rsync patterns, but it seems like include
is only useful if you also have exclude=*
. And once you include something there is no way exclude it. So if I --include=webroot --exclude=*
, I cannot get rid of webroot/scss. Which is how I got to the need to say --exclude=webroot/scss --include=webroot --exclude=*
.
I understand the desire to keep the wrapper simple (and have the options map directly to real rsync options), but IMO this is a real itch if you want to do non-trivial rsync operations.
from rsyncwrapper.
This would address #13 also.
from rsyncwrapper.
Aha, ok. I think I see what you're saying now. You want to be able to define a whitelist of things to include, while excluding everything else, with the added complication of excluding some sub paths.
Have you looked into the --filter
arg? I'm not sure, but it might provide a more idiomatic way of handling the above.
That said, your PR looks good (thanks for the docs and tests!), so I'll merge it right away. Cheers!
from rsyncwrapper.
Related Issues (20)
- Rename option `syncDest` to `delete` or similar HOT 3
- rsync failed on windows, copying persmissions HOT 4
- windows rsync exited with code 11 HOT 1
- cannot provide multiple -f args HOT 4
- Excluded file and directories are being delete. How to exclude but not delete? HOT 1
- Tests fail on iojs HOT 1
- Feature Request: Progress HOT 4
- Unless you enable `verbose`, stdout and stderr in the callback are empty HOT 1
- Args Issue HOT 4
- Gulp task HOT 3
- Doesn't escape src option HOT 5
- Publish a new version to use lodash 4.15.0 HOT 1
- Seems to interfere with console colors on Windows HOT 1
- Update to latest lodash or remove the dependency
- import issue HOT 8
- Issue with escaping space - space in src or dest
- Add support for environment variables HOT 2
- Deprecation warnings in current Node HOT 3
- Is it possible to implement retry logic? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rsyncwrapper.