Is there an easy way to take the output of diff and copy files from dir1 that do not exist in dir2 - but copy them to the same path (many nested directories).
am only trying to copy files in dir1 that do not exist in dir2.
I just want to copy only those files that exist in dir1 to dir2 with the same path.
any ideas or help there?
---------- Post updated at 01:58 PM ---------- Previous update was at 01:57 PM ----------
so if:
dir1/path1/path2/path3/file_exists.txt is here in dir1 but not dir2, then I want to copy file_exists.txt over to dir2 with the same path: like: dir2/path1/path2/path3/file_exists.txt
---------- Post updated at 01:59 PM ---------- Previous update was at 01:58 PM ----------
so if:
dir1/path1/path2/path3/file_exists.txt is here in dir1 but not dir2, then I want to copy file_exists.txt over to dir2 with the same path: like: dir2/path1/path2/path3/file_exists.txt
If you have rsync installed, you can go that route. It'll only copy new files in dir1 to dir2. Just cd into dir1 and run "rsync -avz --stats * /tmp/dir2" and it should only copy files that do not already exist in dir2.
OK, I will try that. Also another requirement is that I want to skip certain meta-data directories like "CVS/". Is there a way to exclude a list of directories?
Also I do not want to copy files that differ, just files that do not exist in one, that do exist in the other. What flag controls this behaviour?