Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • Let's say that after running the above command, I add a new file with .jpg extension to dir1. When I run your command again, does the command just adds .jpg file to dir2? Or the command copy again all the files in dir1 without .txt extention to dir2? Commented Dec 9, 2021 at 1:01
  • 1
    The extension is irrelevant. Rsync has many (many!) flags and options that can customize it's behavior, but usually, by default it just copies the differences. So in your case, it will copy only the new jpg file to dir2, or any other files that exist in dir1 and don't exist on dir2 (except for what you exclude, of course), or any changes in the content or attributes in any file from dir1 to dir2. Rsync first compares those dirs, and only then copies the delta. Commented Dec 9, 2021 at 7:22