Index: preproc/python/FlexpartTools.py
===================================================================
--- preproc/python/FlexpartTools.py	(revision 57637935b8c736ecb0a376df5e8f6a044bbd05af)
+++ preproc/python/FlexpartTools.py	(revision 0e29ef4eb4cd16392d60ff1219d9909ad606ea59)
@@ -353,7 +353,9 @@
         index_keys=["date","time","stepRange"]
         indexfile="date_time_stepRange.idx"
+        silentremove(indexfile)
         grib=GribTools(inputfiles.files)
         iid=grib.index(index_keys=index_keys, index_file = indexfile)
 
+        print 'index done...' 
         silentremove("fort.10")
         silentremove("fort.11")
@@ -389,4 +391,5 @@
                 step = grib_get(gid, 'stepRange')
                 cflextime = self.getFlexpartTime(type,step, time)
+#                print 'cyear '+cyear+'/'+cmonth+'/'+'/EI'+cyear[2:4]+cmonth+cday+cflextime
             while 1:  
                 if gid is None: break
@@ -420,4 +423,5 @@
 # create the corresponding output file  fort.15 (generated by CONVERT2) + fort.16 (paramId 167 and paramId 168)  
                 mkdir_p(outputdir+'/'+cyear+'/'+cmonth+'/')
+                print "outputdir = " + outputdir+'/'+cyear+'/'+cmonth+'/'+'/EI'+cyear[2:4]+cmonth+cday+cflextime
                 fout = open(outputdir+'/'+cyear+'/'+cmonth+'/EI'+cyear[2:4]+cmonth+cday+cflextime,'wb')    
                 shutil.copyfileobj(open('fort.15','rb'), fout)     
@@ -427,5 +431,14 @@
         grib_index_release(iid)
 
-    def clean(self):
+    def __del__(self):
         print "clean"
-
+        silentremove("fort.10")
+        silentremove("fort.11")
+        silentremove("fort.12")
+        silentremove("fort.13")
+        silentremove("fort.15")
+        silentremove("fort.16")
+        silentremove("fort.18")
+        silentremove("VERTICAL.EC")
+        silentremove("date_time_stepRange.idx")
+
Index: preproc/python/GribTools.py
===================================================================
--- preproc/python/GribTools.py	(revision 57637935b8c736ecb0a376df5e8f6a044bbd05af)
+++ preproc/python/GribTools.py	(revision 0e29ef4eb4cd16392d60ff1219d9909ad606ea59)
@@ -118,4 +118,5 @@
 # Create index from a list of files if it does not exist or read it
     def index(self,index_keys=["mars"], index_file = "my.idx"):
+        print "index to be done" 
         self.iid = None
  
Index: preproc/python/getEIdata.py
===================================================================
--- preproc/python/getEIdata.py	(revision 57637935b8c736ecb0a376df5e8f6a044bbd05af)
+++ preproc/python/getEIdata.py	(revision 0e29ef4eb4cd16392d60ff1219d9909ad606ea59)
@@ -92,9 +92,5 @@
     for date in daterange( start, end ):
 # if new year & month then we create a new directory to store output files
-        er_date = date
-        if date.strftime("%Y%m") != current_ym:
-            current_outputdir =  outputdir + "/"  + date.strftime("%Y") + '/' + date.strftime("%m") + '/' 
-            mkdir_p(current_outputdir)
-            if current_ym != "":
+        if date.strftime("%Y%m") != current_ym and current_ym != "":
                retrieve="yes"
 
@@ -106,6 +102,12 @@
                 flexpart = EIFlexpart()
                 dates= ir_date.strftime("%Y%m%d") + "/to/" + er_date.strftime("%Y%m%d") 
+                current_outputdir =  outputdir + "/"  + ir_date.strftime("%Y") + '/' + ir_date.strftime("%m") + '/' 
+                mkdir_p(current_outputdir)
+                print "retrieve " + dates + " in dir " + current_outputdir
                 flexpart.retrieve(server, dates, options.times, options.area, options.levels, current_outputdir)
-                ir_date = er_date
+                ir_date = date
+                retrieve="no"
+
+        er_date = date
 
         current_ym =  date.strftime("%Y%m")
Index: preproc/python/prepareFLEXPART.py
===================================================================
--- preproc/python/prepareFLEXPART.py	(revision 57637935b8c736ecb0a376df5e8f6a044bbd05af)
+++ preproc/python/prepareFLEXPART.py	(revision 0e29ef4eb4cd16392d60ff1219d9909ad606ea59)
@@ -90,5 +90,5 @@
 # data retrieved by year/month
            if cyear != date.year or cmonth != date.month:
-             print 'year : ' + str(date.year) + ' month : ', date.month
+             print 'Prepare year : ' + str(date.year) + ' month : ', date.month
              cyear = date.year
              cmonth = date.month
@@ -102,4 +102,5 @@
              flexpart = EIFlexpart()
              flexpart.create(inputfiles, outputdir)
+             
 
 if __name__ == "__main__":
