title: Inno Setup Cleaning up files with certain extensions after installation
body: <p>I've encountered a certain problem with leftovers after installation with inno setup. </p>
  
  <p>I have set <code>Flags: deleteafterinstall</code> in <code>[FILE]</code> section, and it worked fine untill I added a some code that is renaming destination folder to different name durring installation, and since then Inno Setup is leaving all that files with that flag untouched which looks messy.</p>
  
  <p>As a solution a created this simple batch file that I run in the end of installation via <code>[CODE]</code> section. </p>
  
  <p>Clean_Up.bat:</p>
  
  <pre><code>del /s /f *.rej
  del /s /f *.orig
  del /s /f sed*
  del /s /f *.patch
  del /s /f *.exe
  del /s /f *.bat
  </code></pre>
  
  <p>I'm copying this batch that way:</p>
  
  <pre><code>[FILE]
  Source: "{#CompPath}\BatchFiles\Clean_Up.bat"; DestDir: "{app}\subfolder"; Flags: deleteafterinstall
  </code></pre>
  
  <p>I'm launching it with this:</p>
  
  <pre><code>[RUN]
  Filename: "{app}\res_mods\Clean_Up.bat"; flags: runhidden;
  </code></pre>
  
  <p>The problem is that this batch is suppose to clean up also .batch files, and the result is that <code>CleanUp.bat</code> is also being removed and this is unwanted.</p>
  
  <p>I wanted to solve this by copying it to <code>{app}</code> instead of <code>{app}\subfolder</code>and edit batch file to this:</p>
  
  <pre><code>del /s /f subfolder\*.rej
  del /s /f subfolder\*.orig
  del /s /f subfolder\sed*
  del /s /f subfolder\*.patch
  del /s /f subfolder\*.exe
  del /s /f subfolder\*.bat
  </code></pre>
  
  <p>However it's giving me error: <code>The system cannot find the file specified.</code></p>
  
  <p>Can someone advise me how to make it work? I think the best way would be to rewrite this batch in pascal code and place in the code section, but I don't know how.</p>