You can use diff -x or –exclude=PATTERN options to exclude files that match a PATTERN.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
## exclude files that match PATTERN mkdir mydir{1,2} ## create some files and directories echo "hello" > mydir1/myfile1 echo "linux" > mydir1/file1 echo "world" > mydir2/myfile1 echo "cloud" > mydir2/file1 diff mydir1 mydir2 ## normal output, all are compared ## returns ## diff mydir1/file1 mydir2/file1 ## 1c1 ## < linux ## --- ## > cloud ## diff mydir1/myfile1 mydir2/myfile1 ## 1c1 ## < hello ## --- ## > world diff --exclude="my*" mydir1 mydir2 ## compares only file1 ## returns ## 1c1 ## < linux ## --- ## > cloud diff --exclude="file*" mydir1 mydir2 ## compares only myfile1 ## returns ## 1c1 ## < hello ## --- ## > world rm -r my* |