title: Build images and some configuration files like txt and xml files with pyinstaller
body: <p>I have a trouble with pyinstaller when adding some data files like images and txts to python program. For example, I have created a toolbar with icons, and I store them in a seperate folder named images. Also I have some some txt and xml files to store some configurations. These txt ant xml files are stored in another folder named data_files. All the py files are stored in another folder named source.</p>
  <p>When I am trying to build this python program with pyinstaller, pyinstaller can successfully build all of the source folder, but the images and data_files folders can not be built. I checked the documentation of pyinstaller but I could not find any solution. I have made a lot of google searches and found only <a href="https://stackoverflow.com/questions/7674790/bundling-data-files-with-pyinstaller-onefile">this</a> resourse as helpful, but this is a very inadequate resource.</p>
  <p>My main question is: How can I build an exe file with a separately built folder such as images and confs by using pyinstaller?</p>
  <p><strong>Edit:</strong>
  I found the solution. When you create the spec file you have to <strong>a.datas</strong> parameter.</p>
  <pre><code># -*- mode: python -*-
  a = Analysis([os.path.join(HOMEPATH,'support/_mountzlib.py'), os.path.join(HOMEPATH,'support/useUnicode.py'), '/home/vmode/Desktop/derlem2/sources/TextSTAT.py'],
               pathex=['/home/pyinstaller'])
  a.datas += [(&quot;Images/New.gif&quot;,&quot;/home/vmode/Desktop/derlem2/Images/New.gif&quot;,&quot;DATA&quot;)]
  a.datas += [(&quot;Images/Open.gif&quot;,&quot;/home/vmode/Desktop/derlem2/Images/Open.gif&quot;,&quot;DATA&quot;)]
  a.datas += [(&quot;Images/Column.gif&quot;,&quot;/home/vmode/Desktop/derlem2/Images/Column.gif&quot;,&quot;DATA&quot;)]
  pyz = PYZ(a.pure)
  exe = EXE( pyz,
            a.scripts,
            a.binaries,
            a.zipfiles,
            a.datas,
            name=os.path.join('dist', 'TextSTAT'),
            debug=False,
            strip=False,
            upx=True,
            console=1 )
  </code></pre>
  <p>The above spec code is designed for my project. As seen in this spec code I have included 3 icons to build with the python program. When the programme is generated there is a standalone executable file with embedded these icons.</p>
  <p>But what if we have so many files? Suppose that we have 1000 icons to use in our program. It is very inadequate to write down to spec file by hand. There must be a loop system to read the file directory and add these files dynamically. But I could not find how to add these files dynamically. There is no any chance to add these so many files by hand I think. If anyone knows please share.</p>