X-Git-Url: http://iramuteq.org/git?p=iramuteq;a=blobdiff_plain;f=chemins.py;h=4e50a484fe604d51c3a1a033b72249c3231c75a8;hp=f43969cc956ac828ecafe922ce79db68a0e00dda;hb=287f9e72c3e3d666b016dff0fa3dc39419adfcc2;hpb=c440e446cdf3ff08f6bcd37c5061da3c5f29dc37 diff --git a/chemins.py b/chemins.py index f43969c..4e50a48 100644 --- a/chemins.py +++ b/chemins.py @@ -45,6 +45,14 @@ class PathOut : tdirout = dirout + `nb` self.name = os.path.splitext(tdirout)[1] return tdirout + + def makenew(self, filename, ext): + nb = 1 + newfile = '_'.join([os.path.join(self.dirout, filename), '%i' % nb]) + '.' + ext + while os.path.exists(newfile) : + nb += 1 + newfile = '_'.join([os.path.join(self.dirout, filename), '%i' % nb]) + '.' + ext + return newfile def createdir(self, tdirout) : if not os.path.exists(tdirout) :