0

I need to copy directory structure from one place to another. I need to copy only folders and symlinks.

I use command

find $SOURCE_PATH/ \( -type l -o -type d \)  -printf "%P\0" | rsync --files-from - --from0 -av  $SOURCE_PATH $USER@$DESTINATION_SERVER:/$DESTINATION_PATH/$SOURCE_PATH

Command is successful and it copy folder and links. My problem is because links point to the old destination.
my source path is app/cg/dev and destination path is tmp/app/cg/dev and now my links which i copied are pointing to app/cg/dev/somefolder . i need them to point on tmp/app/cg/dev/somefolder.

After i rsync all links, good way to correct them would be if i could read link path and than just concatenate my destination path. example

find . -type l | while read l; do
concatenate destination folder and readlink l
done

can someone help me write that code?

0 Answers0