1
I am trying to copy the files not present in one directory to the other directory by using awk
diff -r dir1 dir2 | grep dir1 | awk '{$1=$2=$3 =""; print "cp \"./dir1/" substr($0,4) "\" ./dir2/"}' | sh
This works fine except that I also want to print the file that is being copied. Something like cp ./dir1/file1.txt ./dir2/
on stdout
How do I do this. I know it's simple but I can't figure it out. I tried tee
and echo
commands but in vain.
print on screen or print on some printer? – Adam Silenko – 2016-11-19T13:47:21.060
@AdamSilenko On screen or say stdout – Rohit Walavalkar – 2016-11-19T13:50:25.873
1
Possible duplicate of What is the shell command to display contents of a file?
– Adam Silenko – 2016-11-19T15:26:37.443Any reason not to use rsync? – user657451 – 2016-11-19T20:26:30.367
@user657451 I didn't know about rsync. Not sure if it serves the purpose. – Rohit Walavalkar – 2016-11-20T06:58:19.977