title: How to check all files in a directory except one file in Groovy language
body: <p>I am trying to search a word in every file in a directory but I want to exclude my logfile.</p>
  <p>My code is something like this</p>
  <pre><code>user input: search test C:\Users\Desktop\test\Groovy
  
  
  </code></pre>
  <p>My code</p>
  <pre><code>import static groovy.io.FileType.FILES
  import java.text.SimpleDateFormat
  
  def terminal_log = new File(&quot;terminal.log&quot;)
  def terminal_log_path = terminal_log.getName()
  def fas = &quot;&quot;
  def file2_path = &quot;&quot;
  def cmd = System.console().readLine 'Enter command: '
  String[] csplice = cmd.split(&quot; &quot;);
  if(csplice.length == 3){
      def first_parameter = csplice[0]
      def second_parameter = csplice[1]
      def third_parameter = csplice[2]
      if(first_parameter == &quot;search&quot;){
          def file = new File(third_parameter)
          if(file.exists()){
              if(file.isDirectory()){
                  file.eachFile(FILES) { f -&gt; 
                      fas = &quot;/&quot;+f+&quot;/&quot;
                      File file2 = new File(fas)
                      file2_path = file2.getName()
                      if(!file2_path == terminal_log_path){
                          file2.eachLine{ line -&gt;
                              if(line.contains(second_parameter)){
                                  println &quot;This file contains this word&quot;
                              }
                          }
                      }
                  }
              }else{
                  println &quot;Not a directory&quot;
              }
          }else{
              println &quot;Not exists&quot;
          }
      }else{
          println &quot;Invalid command&quot;
      }
  }else{
      println &quot;Invalid command&quot;
  }
  </code></pre>
  <p>This block here is not working</p>
  <pre><code>if(!file2_path == terminal_log_path){
  </code></pre>
  <p>Is there any documentation that I can read to exclude a specific file while checking every files in a directory?</p>
  <p>Many thanks</p>
  <p>EDIT:
  the directory of the user input has the logfile (terminal.log)
  terminal.log exists</p>