bash - Sync from dir1 and dir2, and keep the two directory same -
i want sync source directory local directory, used use command: rsync -av /path1/dir1 /path2/dir2
, add contents of dir1 dir2.
however, want keep dir1 , dir2 same. not hope else can add files dir2 without using rsync command (means want delete other contents not belongs dir1 when sync dir1 dir2)
thanks!
according the documentation:
--delete delete files don’t exist on sender
so, following should work:
rsync -av --delete /path1/dir1 /path2/dir2
Comments
Post a Comment