I'm using the following command to synch files from one folder to another on my local OSX system:

rsync -avC ./src ~/Sites

Inside of ./src there are several sub-folders:

  • ./src/assets
  • ./src/core
  • ./src/css
  • ./src/js

All folders and content are copied as expected, except for ./src/core. Renaming the folder resolves the problem, but isn't an option. For example, named as ./src/core2 and it works.


It does that because you asked it to. Specifically, you asked with -C that it "ignore things like CVS does".

That includes various junk like core dumps that are not really interesting at the far side of the link. Except it does that by name rather than "type and name", so your directory gets caught in the mix.

From rsync(1), the list of what it excludes:

RCS  SCCS CVS CVS.adm RCSLOG cvslog.* tags TAGS .make.state .nse_depinfo *~ #*
.#* ,* _$* *$ *.old *.bak *.BAK *.orig *.rej .del-* *.a *.olb *.o  *.obj  *.so
*.exe *.Z *.elc *.ln core .svn/ .git/ .hg/ .bzr/

To ignore files and folders from CVS and include the "core" folder, explicitly include "core" like so:

rsync -avC --include "core" ./src ~/Sites
  • Ah, I need it to ignore .svn stuff, but not a folder named "core" Overlooked core in that list. Thank you. – Michael Prescott Feb 10 '12 at 5:01
  • Can I do both? First, exclude all that, but then include just my "core" – Michael Prescott Feb 10 '12 at 5:03
  • I think an explicit include will override the exclude. Give it a shot. – Daniel Pittman Feb 10 '12 at 5:06
  • Yes, the solution: rsync -avC --include "core" ./src ~/Sites – Michael Prescott Feb 10 '12 at 5:19
  • Also, rsync respects the ignore list in .cvsignore. – Jānis Elmeris Feb 3 '14 at 12:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.