# -*- coding: utf-8 -*- import os fileList = []
dzList = [] def GetFileList(path):
List = []
for root,dirs,files in os.walk(path):
for fn in files:
List.append(root + os.sep + fn)
return List def GetUrlPath(List):
UrlPathList = []
f = open("discuz72.txt","w")
for ll in List:
f.write( "/".join(ll[ll.find("dz72")+len("dz72"):].split(os.sep)))
f.write(os.linesep) if __name__ == "__main__":
GetUrlPath(GetFileList(r"E:\xampp\htdocs\dz72"))
我的本地网站根目录是htdocs,discuz7.2存储在dz72目录下。