def checkInputDir(self):
        """ Checks the input file dir filenames etc. for validity
            Returns an error code if the specified directory is bad.
        """
        if not os.path.isdir(self.dirName):
            print("ERROR: directory %s doesn't exist" % self.dirName)
            return(1)

        # list all datas that will be processed
        alldatas = []
        try:
            for root, dirs, files in os.walk(str(self.dirName)):
                for filename in files:
                    if filename.lower().endswith('.wav.data'):
                        alldatas.append(os.path.join(root, filename))
        except Exception as e:
            print("ERROR: could not load dir %s" % self.dirName)
            print(e)
            return(1)


        # TODO Note: this is a bit fidgety as needs to be adapted to each survey
        recsInDirNames = False
        defaultToDMY = True

        # read in all datas to self.annots
        for f in alldatas:
            # must have correct naming format:
            infilestem = os.path.basename(f)[:-9]

            try:
                if recsInDirNames:
                    recname = os.path.basename(os.path.normpath(os.path.dirname(f)))
                    filedate, filetime = infilestem.split("_")  # get [date, time]
                else:
                    recname, filedate, filetime = infilestem.split("_")  # get [rec, date, time]
                datestamp = filedate + '_' + filetime  # make "date_time"
                # check both 4-digit and 2-digit codes (century that produces closest year to now is inferred)
                if len(filedate)==8:
                    d = dt.datetime.strptime(datestamp, "%Y%m%d_%H%M%S")
                else:
                    if defaultToDMY:
                        try:
                            d = dt.datetime.strptime(datestamp, "%d%m%y_%H%M%S")
                        except ValueError:
                            d = dt.datetime.strptime(datestamp, "%y%m%d_%H%M%S")
                    else:
                        try:
                            d = dt.datetime.strptime(datestamp, "%y%m%d_%H%M%S")
                        except ValueError:
                            d = dt.datetime.strptime(datestamp, "%d%m%y_%H%M%S")
                print("Recorder ", recname, " timestamp ", d)
                # timestamp identified, so read this file:
                segs = Segment.SegmentList()
                try:
                    segs.parseJSON(f, silent=True)
                except Exception as e:
                    print("Warning: could not read file %s" % f)
                    print(e)
                    continue

                # store the wav filename
                segs.wavname = f[:-5]
                segs.recname = recname
                segs.datetime = d
                self.annots.append(segs)

                # also keep track of the different recorders
                self.allrecs.add(recname)
            except ValueError:
                print("Could not identify timestamp in", f)
                continue
        print("Detected recorders:", self.allrecs)
        return(0)