#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os
# 3 avg
#
#--------------------------------------------------
L = []
ln = 0
def parse_dir(ph):
, ,global L
, ,dirlist = os.listdir(ph)
, ,dirlist.sort()
, ,for i in dirlist:
, , , ,adr = os.path.join(ph, i)
, , , ,if os.path.isdir(adr):
, , , , , ,parse_dir(adr)
, , , ,else:
, , , , , ,hh = ph[ln:]
, , , , , ,L.append(hh+'|'+ str(os.path.getsize(adr))+'|'+i+ '\n')
#----------------------------------------
def SaveList(L):
, , , ,f = open('tree2.txt', 'w')
, , , ,for i in L:
, , , , , ,f.write(i)
, , , ,f.close()
#----------------------------------------
path = os.getcwd()
ln = len(path) + 1
#----------------------------------------
parse_dir(path)
SaveList(L)
print( 'Done!')