Index: python/UIOFiles.py
===================================================================
--- python/UIOFiles.py	(revision efdb01a8ac2d5cef85c651177aa18ac69dd660db)
+++ python/UIOFiles.py	(revision 991df6ad0a703d97e1e192a0a6106e1d9ba47e8e)
@@ -3,38 +3,46 @@
 #************************************************************************
 # TODO AP
-#AP
 # - checken welche regelmässigen methoden auf diese Files noch angewendet werden
 # und dann hier implementieren
-# - add description of file!
+# cleanup hier rein
 #************************************************************************
-"""
-@Author: Anne Fouilloux (University of Oslo)
+#*******************************************************************************
+# @Author: Anne Fouilloux (University of Oslo)
+#
+# @Date: October 2014
+#
+# @Change History:
+#
+#    November 2015 - Leopold Haimberger (University of Vienna):
+#        - modified method listFiles to work with glob instead of listdir
+#        - added pattern search in method listFiles
+#
+#    February 2018 - Anne Philipp (University of Vienna):
+#        - applied PEP8 style guide
+#        - added documentation
+#        - optimisation of method listFiles since it didn't work correctly
+#          for sub directories
+#        - additional speed up of method listFiles
+#        - modified the class so that it is initiated with a pattern instead
+#          of suffixes. Gives more precision in selection of files.
+#
+# @License:
+#    (C) Copyright 2014-2018.
+#
+#    This software is licensed under the terms of the Apache Licence Version 2.0
+#    which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+#
+# @Class Decription:
+#    The class is for file manipulation. It is initiated with a regular
+#    expression pattern for this instance and can produce a list of Files
+#    from the given file pattern. These files can be deleted.
+#
+# @Class Content:
+#    - __init__
+#    - listFiles
+#    - deleteFiles
+#
+#*******************************************************************************
 
-@Date: October 2014
-
-@ChangeHistory:
-    November 2015 - Leopold Haimberger (University of Vienna):
-        - modified method listFiles to work with glob instead of listdir
-        - added pattern search in method listFiles
-
-    February 2018 - Anne Philipp (University of Vienna):
-        - applied PEP8 style guide
-        - added documentation
-        - optimisation of method listFiles since it didn't work correctly
-          for sub directories
-        - additional speed up of method listFiles
-
-@License:
-    (C) Copyright 2014-2018.
-
-    This software is licensed under the terms of the Apache Licence Version 2.0
-    which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-
-@Requirements:
-    A standard python 2.6 or 2.7 installation
-
-@Description:
-    ...
-"""
 # ------------------------------------------------------------------------------
 # MODULES
@@ -44,12 +52,17 @@
 import fnmatch
 import time
+
+# software specific module from flex_extract
 import profiling
+from Tools import silentremove
+
 # ------------------------------------------------------------------------------
 # CLASS
 # ------------------------------------------------------------------------------
+
 class UIOFiles:
     '''
     Class to manipulate files. At initialisation it has the attribute
-    suffix which stores a list of suffixes of the files associated
+    pattern which stores a regular expression pattern for the files associated
     with the instance of the class.
     '''
@@ -57,9 +70,8 @@
     # CLASS FUNCTIONS
     # --------------------------------------------------------------------------
-    def __init__(self, suffix):
+    def __init__(self, pattern):
         '''
         @Description:
-            Assignes the suffixes of the files which should be
-            associated with the instance of the class.
+            Assignes a specific pattern for these files.
 
         @Input:
@@ -67,7 +79,6 @@
                 Description see class documentation.
 
-            suffix: list of strings
-                The types of files which should be manipulated such as
-                ['grib', 'grb', 'grib1', 'grib2', 'grb1', 'grb2']
+            pattern: string
+                Regular expression pattern. For example: '*.grb'
 
         @Return:
@@ -75,15 +86,14 @@
         '''
 
-        self.suffix = suffix
+        self.pattern = pattern
 
         return
 
     #@profiling.timefn
-    def listFiles(self, path, pattern, callid=0):
+    def listFiles(self, path, callid=0):
         '''
         @Description:
             Lists all files in the directory with the matching
-            regular expression pattern. The suffixes are already stored
-            in a list attribute "suffix".
+            regular expression pattern.
 
         @Input:
@@ -93,8 +103,4 @@
             path: string
                 Directory where to list the files.
-
-            pattern: string
-                Regular expression pattern. For example:
-                '*OG_acc_SL*.'+c.ppid+'.*'
 
             callid: integer
@@ -115,8 +121,7 @@
 
         # get the file list of the path if its not a directory and
-        # if it contains one of the suffixes
+        # if it contains the pattern
         self.files.extend([os.path.join(path, k) for k in os.listdir(path)
-                           if fnmatch.fnmatch(k, pattern) and
-                           os.path.splitext(k)[-1] in self.suffix])
+                           if fnmatch.fnmatch(k, self.pattern)])
 
         # find possible sub-directories in the path
@@ -127,5 +132,23 @@
         if subdirs:
             for subdir in subdirs:
-                self.listFiles(os.path.join(path, subdir), pattern, callid=1)
+                self.listFiles(os.path.join(path, subdir), callid=1)
 
         return
+
+    def deleteFiles(self):
+        '''
+        @Description:
+            Deletes the files.
+
+        @Input:
+            self: instance of UIOFiles
+                Description see class documentation.
+
+        @Return:
+            <nothing>
+        '''
+
+        for f in self.files:
+            silentremove(f)
+
+        return
