0

I spent a lot of time to find a solution for my problem or find what am i doing wrong. I would like to save my user home folder into another, mounted folder...so I thought, I am going to use rsync...but! I have this include file:

+ /home/
+ /home/developer/
+ /home/developer/save_only_this_folder/*.*
+ /home/developer/.gitconfig
+ /home/developer/.kube
- *

So as you can see I would like to save some folders with contents and a file (.gitignore) Command what i am using:

rsync -azhv --dry-run
--include-from=/home/developer/preparation/rsync_include.lst /home/developer/ /mnt/c/Work/WSL/save/ubuntu20.04/home

...and yes, I am using WSL.

The result: copy everything under /home/developer folder not only those what are listed in import file.

Question would be: what am I doing wrong? Can anyone help me?

Thanks!

aBanhidy
  • 257
  • 1
  • 3
  • 11
  • 1
    Include/exclude patterns are matched *relative to the root of the transfer*, so you should not include "/home/developer" in the pattern paths. Also, since you're using WSL, make sure the include file has unix-style line endings, not Windows-style (see [this question](https://stackoverflow.com/questions/39527571/are-shell-scripts-sensitive-to-encoding-and-line-endings) for info). – Gordon Davisson Jul 14 '23 at 08:01
  • Hello @GordonDavisson! Thanks for your answer...you are right, this was the problem, now it is working perfectly! May I ask to add your comment as an answer to accept it? Thanks! – aBanhidy Jul 14 '23 at 09:33

0 Answers0