# coding: utf-8
import os.path
m_dir2 = r'C:\Users\holodnuk\Desktop\Challenges'
m_dir = r'C:\Users\holodnuk\Desktop'
m_exe = '.deb'
def have_ext(elem, ext='.deb'):
"""
Test if file retain to extension chosen type
:param elem:
:param ext:
:return:
"""
if elem.find(ext) > 0:
return True
def summon_path(tup):
l_deb = list()
l_file = tup[2]
for i in range(len(l_file)):
if have_ext(l_file[i]):
ss = str(tup[0])+'\\' + str(tup[2][i])
l_deb.append(ss)
return l_deb
def cycle():
l = list()
l_res = list()
for pack in (os.walk(m_dir, topdown=True)):
# print(pack)
l.append(pack)
for i in range(len(l)):
ll = summon_path(l[i])
for j in range(len(ll)):
l_res.append(ll[j])
return l_res
if __name__ == '__main__':
l_res = cycle()
print(l_res)