I'd like to copy from /A to /C only paths missing on /B and /C. (Please assume those are paths, and can represent also remote locations e.g. mounted via sshfs
)
I wonder... Is there more concise way then writing a loop, iterating over filesystem and making check, file by file ?
Example contents of tree directories /A, /B, /C :
/A:
/A/1abc/qwe
/A/2abc/asd
/A/3abc/zxc
/A/4abc/rty
/B:
/A/2abc/asd
/A/3abc/zxc
/C:
/C/1abc/qwe
expected:
to copy from /A to /C only path 4abc/rty
:
/A/4abc/rty -> /C/4abc/rty
To illustrate practical examples of /A, /B, /C, leading to such scenario:
- you make backup, copy from some /source (/A) to some /destination (/B) and some paths failed to be copied. So you want to have copy anyway of missing ones. So you find /another_destination (/C) that can accept them, and you want to copy only missing ones. Here are example limitations why copy from /A to /B could fail: disc got full; limitation of filesystem of /B (like filename lenght), while not present on /C filesystem; etc.
A
,B
&C
are on same machine or are they remotely resided ? – Rahul Jun 20 '16 at 10:35