diff -r dir1 dir2 | grep dir1 | awk '{print $4}' > difference1.txt
Explanation:
-
diff -r dir1 dir2shows which files are only in dir1 and those only in dir2 and also the changes of the files present in both directories if any. -
diff -r dir1 dir2 | grep dir1shows which files are only in dir1 -
awkto print only filename.