目录:
一、Python源码
二、json文件存储的文件信息
一、Python源码
import os
import json
def get_files(rootPath):
filePath = []
for filepath,dirnames,filenames in os.walk(rootPath):
for filename in filenames:
filePath.append(os.path.join(filepath, filename))
return filePath
def read_json(jsonUrl):
with open(jsonUrl,encoding='UTF-8') as json_file:
jsonDa = json.load(json_file)
return jsonDa
jsonPath = []
def get_json(rootpath,jsonData):
for re in jsonData:
folderName = rootpath +'\\' + re['folderName']
fileNames = re['fileNames']
for fileName in fileNames:
jsonPath.append(folderName+'\\'+fileName)
try:
folders = re['folders']
get_json(folderName,folders)
except:
pass
ro
|