title: Input and Output folders for Python
body: <p>I want to have the code pull from a input folder and export to a output folder. I would like to be able to read multiple files, run the code, and then output the multiple files into an output folder. How would I approach this?</p>
  <p>'Here is my code:</p>
  <pre><code>import re
  
  with open(&quot;SanitizedFinal_E4300.txt&quot;, &quot;rt&quot;) as fin:
  with open(&quot;output6.txt&quot;, &quot;wt&quot;) as fout:
  
  for line in fin:
      line = line.replace('set system host-name EX4300', 'hostname &quot;EX4300&quot;')
      line = line.replace('set interfaces ge-0/0/0 unit 0 family inet address', 'ip address')
  
      line = re.sub(r'set interfaces ge-0/0/0 description (.*)', r'interface 1/1\nname &quot;\1&quot;', line)
      line = re.sub(r'set interfaces ge-0/0/1 description (.*)', r'interface 1/2\nname &quot;\1&quot;', line)
  </code></pre>
  <p>#and so on...</p>
  <p>fout.write(line)</p>