jython2.7 获取本地文件夹文件列表
文件夹文件列表
1 import os 2 import json 3 try: 4 flowFile = session.get() 5 filePath = flowFile.getAttribute('文件夹路径'.decode('utf8')) 6 hasStr = flowFile.getAttribute('包含的字符'.decode('utf8')) 7 noStr = flowFile.getAttribute('不包含字符'.decode('utf8')) 8 attrName = flowFile.getAttribute('存放属性名'.decode('utf8')) 9 shareFileName = flowFile.getAttribute('共享目录'.decode('utf8')) 10 dirs = os.listdir( shareFileName+filePath ) 11 flowFile = session.putAttribute(flowFile, attrName, json.dumps(dirs).decode('unicode_escape')) 12 session.transfer(flowFile, REL_SUCCESS) 13 except: 14 session.transfer(flowFile, REL_FAILURE)
做你说过的 说你能做的;