-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyle_list_generator.py
53 lines (35 loc) · 941 Bytes
/
style_list_generator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Generate a text file with names of all images in Content Image folder
'''
__author__ = 'Sneh Sagar'
__copyright__ = None
__credits__ = ['Sneh Sagar']
__license__ = 'GPL'
__version__ = '1.0.1'
__email__ = '[email protected]'
__status__ = 'Production'
import os
def generator():
# Getting the current work directory (cwd)
thisdir = os.path.dirname(os.path.realpath(__file__)) \
+ '/Content Images'
images = []
# r=root, d=directories, f = files
for (r, d, f) in os.walk(thisdir):
for file in f:
images.append(file)
images.sort()
def itemName(item):
name = ''
for i in item:
if i == '.':
break
name += i
return name
f = open('style_image_list.txt', 'w')
for item in images:
f.write(itemName(item))
f.write('\n')
f.close()