title: Dynamically building a exlude list for both rsync & egrep format
body: <p>I wonder if anyone out there can assist me in trying to solve a issue with me.</p>
  
  <p>I have written a set of shell scripts with the purpose of auditing remote file systems based on a GOLD build on a audit server.</p>
  
  <p>As part of this, I do the following:</p>
  
  <p>1) Use rsync to work out any new files or directories, any modified or removed files</p>
  
  <p>2) Use <code>find ${source_filesystem} -ls</code> on both local &amp; remote to work out permissions differences</p>
  
  <p>Now as part of this there are certain files or directories that I am excluding, i.e. logs, trace files etc.</p>
  
  <p>So in order to achieve this I use 2 methods:</p>
  
  <p>1) RSYNC - I have an exclude-list that is added using <code>--exclude-from</code> flag</p>
  
  <p>2) <code>find -ls</code> - I use a <code>egrep -v</code> statement to exclude the same as the rsync exclude-list:</p>
  
  <p>e.g. <code>find -L ${source_filesystem} -ls | egrep -v "$SEXCLUDE_supt"</code></p>
  
  <p>So my issue is that I have to maintain 2 separate lists and this is a bit of a admin nightmare.</p>
  
  <p>I am looking for some assistance or some advice on if it is possible to dynamically build a list of exlusions that can be used for both the rsync or the <code>find -ls</code>?</p>
  
  <p>Here is the format of what the exclude lists look like::</p>
  
  <p>RSYNC:</p>
  
  <pre><code>*.log
  *.out
  *.csv
  logs
  shared
  tracing
  jdk*
  8.6_Code
  rpsupport
  dbarchive
  inarchive
  comms
  PR116PICL
  **/lost+found*/
  dlxwhsr*
  regression
  tmp
  working
  investigation
  Investigation
  dcsserver_weblogic_*.ear
  dcswebrdtEAR_weblogic_*.ear
  </code></pre>
  
  <p>FIND:</p>
  
  <pre><code>SEXCLUDE_supt="\.log|\.out|\.csv|logs|shared|PR116PICL|tracing|lost\+found|jdk|8\.6\_Code|rpsupport|dbarchive|inarchive|comms|dlxwhsr|regression|tmp|working|investigation|Investigation|dcsserver_weblogic_|dcswebrdtEAR_weblogic_"
  </code></pre>