-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutilis.py
34 lines (31 loc) · 949 Bytes
/
utilis.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# !/usr/bin/env python
# --------------------------------------------------------------
# File: utilis.py
# Project: MOEA-D
# Created: Sunday, 5th May 2019 10:39:04 am
# @Author: molin@live.cn
# Last Modified: Sunday, 5th May 2019 10:39:06 am
# Copyright © Rockface 2018 - 2019
# --------------------------------------------------------------
import os, sys
def getOutPath(outDir, preFix):
outDirFiles = os.listdir(outDir)
i = 0
tempDirName = preFix + str(i)
while tempDirName in outDirFiles:
i+=1
tempDirName = preFix + str(i)
tempDirName = os.path.join(outDir, tempDirName)
return tempDirName
def getLatest(inDir, preFix, type=None):
inDirFiles =os.listdir(inDir)
i = 0
if type!=None:
tempDirName = preFix+str(i)+type
else:
tempDirName = preFix+str(i)
while tempDirName in inDirFiles:
i+=1
tempDirName = preFix + str(i)
tempDirName = preFix+str(i-1)
return os.path.join(inDir, tempDirName)