Im looking to sync or copy files from FolderA to FolderB. Im currently using the following command

rsync -aq /tmp/FolderA/* /tmp/FolderB

However I see entries within files that were modified within FolderB disappearing. I thought the following command would help with that but seems to be not working.

rsync -aqu /tmp/FolderA/* /tmp/FolderB

In the end Im trying to update files within FolderA to FolderB and NOT remove any entries that may have been put into files under FolderB.

At the same time if something changed within the files in FolderA it should update the file, not append, in FolderB without losing any other information. I thought rsync commands would help with that?

is the -a messing it up? Should I use -r or --inplace?

Thanks in advance.

  • 1
    What do you mean by "entries"? What do you mean by "update"? The -u flag will prevent newer files in FolderB from changing at all, but they won't be "updated" in any way then. Are there lines in files in FolderA you want to add to the corresponding files in FolderB without losing new information in the destination files? I don't think rsync can do that alone.
    – frabjous
    Commented Mar 10, 2022 at 17:10
  • 1
    It sounds like you might want something that synchronizes the contents of files, but rsync only operates on entire files, not the "entries" in them. You may need a different tool, but without more clarity in what you're trying to achieve, I can't tell what that might be. Commented Mar 10, 2022 at 19:16

2 Answers 2


You should only use the -a option if you really want to use all that comes with it, I know it's easier seeming at first, but it can cause issues. --archive, -a archive mode; equals -rlptgoD (no -H,-A,-X) That's a lot of options haha.

You probably can get away with rsync -ruP /tmp/folderA/ /tmp/folderB/. -P is for progress, it can be nice on longer transfers. -r is recursive, that's for your directories. -u is for updating, not appending to files.

Also note that if you do /tmp/folderA without the trailing slash, it will move the entire folderA into the destination, whereas /tmp/folderA/ will move things from inside folderA to destination. Don't forget the recursive option for directories though!


rsync operates on files without regard to their content. If you are copying from FolderA to FolderB then you will get matching copies of the files in FolderA placed into FolderB. There are various flags that control aspects of the process but the fundamental task remains the same: copy files from the source to the destination.

You can arrange that files more recently updated in FolderB than FolderA are skipped.

You can arrange that files matching certain patterns are skipped.

But you cannot have rsync interpret the contents of the files and only copy lines or records matching some user-defined criteria.

Your command will copy all files, directories, and device nodes from FolderA to FolderB, overwriting or updating files in FolderB when they don't already match FolderA:

rsync -a /tmp/FolderA/ /tmp/FolderB

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .