title: OSX Terminal - export to csv list of files inside folder
body: <p>-- CONTEXT and what's working so far --</p>
  <p>I use this command in OSx Terminal to get a csv file with all filenames structured according to their paths, inside a folder:</p>
  <pre><code>find 'folder' -type f -print | sed 's_/_,_g' &gt; ~/filelist.csv
  </code></pre>
  <p>Other info:</p>
  <ul>
  <li>Folder name - doesn't contain &quot;duc&quot; for sure</li>
  <li>Subfolders</li>
  </ul>
  <p>a) Subfolders may or may not contain &quot;duc&quot; string in their name (as for now they don't but I can't be sure if it will happen or not in the future)</p>
  <p>b) All subfolders may or may not contain files that contain the string in their names</p>
  <p>-- WHAT I WOULD LIKE --</p>
  <ul>
  <li><p>That the filelist.csv would list/have filenames that contain a string in their name: &quot;duc&quot; and its variations - duc, DUC, DuC... (e.g. &quot;12345 duc.pdf&quot;, &quot;12345 DUC2.pdf&quot;)</p>
  </li>
  <li><p>The list should also show filepaths</p>
  </li>
  <li><p>It should be taken into consideration that these files may or may not be inside a subfolder with the string in its filename</p>
  </li>
  </ul>
  <p>Can anyone give me a hand?
  Thank you in advance</p>