title: How to exclude files using ls?
body: <p>I'm using a python script I wrote to take some standard input from <code>ls</code> and load the data in the files described by that path. It looks something like this:</p>
  
  <pre><code>    ls -d /path/to/files/* | python read_files.py
  </code></pre>
  
  <p>The files have a certain name structure based on what data they have in them but are all stored in the same directory. The files I want to use have the name structure <code>A&lt;fileID&gt;_###.txt</code> (where <code>###</code> is always some 3 digit number). I can accomplish getting only the files that start with A by just changing what I have above slightly to <code>ls -d /path/to/files/A*</code>. HOWEVER, some files have a suffix flag called B (so the file looks like <code>A&lt;fileID&gt;_###B.txt</code>) and I DO NOT want to include those.</p>
  
  <p>So, my question is, is there a way to exclude those files that end in <code>...B.txt</code> (or a way to only include files that end in a number)? I thought about something to the effect of:</p>
  
  <pre><code>    ls -d /path/to/file/R*%d.txt
  </code></pre>
  
  <p>to only include files that end in a number followed by the file extension, but couldn't find any documentation on anything of the sort.</p>