You can use diff -X or –exclude-from=FILE options to exclude files that match any pattern ‘in’ FILE.
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 |
## exclude files that match any pattern 'in' FILE 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 echo "my*" > myfile 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-from=myfile mydir1 mydir2 ## excludes myfile1 ## returns ## 1c1 ## < linux ## --- ## > cloud rm -r my* |