jython2.7 新建文件夹

新建文件夹

 1 import os
 2 def mkdir(path):
 3     folder = os.path.exists(path)
 4     if not folder:
 5         os.makedirs(path)
 6 try:
 7     flowFile = session.get()
 8     f1 = flowFile.getAttribute('filePath')
 9     f2 = flowFile.getAttribute('fileExist')
10     dir = '/shared/winshare/'+f1
11     if f1 !="":
12         if f2 == "delete":
13             os.remove(dir)
14         mkdir(dir)
15     session.transfer(flowFile, REL_SUCCESS)
16 except:
17     session.transfer(flowFile, REL_FAILURE)

 

posted @ 2021-07-22 14:22  木章  阅读(34)  评论(0编辑  收藏  举报