4 ms·
rsync-pro-tip: use a trailing slash on both the source/ and the target/ and you'll never go wrong
by gjvc 6y ago
rsync-pro-tip: use a trailing slash on both the source/ and the target/ and you'll never go wrong
- kzrdude 6y agoWhat goes wrong if I don't do that?
- masklinn 6y agoThe trailing slash on the source expresses that you want to copy the contents of the source in the dest, otherwise you’ll copy the source itself (creating a subdirectory).
- jjice 6y agoI believe if you don't use a slash at the end of the source directory, it will copy the _directory_, not just its contents. rsync code remote:/ I believe that results in remote:/code/app.js rsync code/ remote:/ I believe that results in remote:/app.js
- gjvc 6y agoGood explanation -- at the risk of mindlessly repeating you, my reason for the "always use trailing/ slashes/" suggestion is that the behaviour in that case has (for me at least) always been the scenario desired most often: rsync /some/where/local/ host:/another/place/remote/ The contents of local/ go into remote/