3

Is it somehow possible to import a folder structure into a resources file?

I have folders such as:

- JS
  - Lots of JS files
- Images
  - Lots of images

etc.

I can only seem to import one file at a time, I have around 80 files.

Any ideas?

László Papp
  • 51,870
  • 39
  • 111
  • 135
user3490755
  • 955
  • 2
  • 15
  • 33

1 Answers1

0

I am not aware of anything, but this python script should give you some idea for a quick'n dirty workaround:

main.py

import os

print('<RCC>')
print('<qresource prefix="/">')

for root, dirs, files in os.walk(sys.argv[1]):
    for name in files:
        print('<file>%s</file>' % name)

print('</qresource>')
print('/RCC')

Then, you can invoke the script as follows:

python main.py myfolder

Diclaimer: the code does not check against len(sys.argv), etc, but it would be pretty simple to extend and hand-craft it further. It does not write into a dedicated file either, but you can redirect the output, and so on.

László Papp
  • 51,870
  • 39
  • 111
  • 135