def compute(self):
        input_dir = self.get_input("dir")
        output_path = self.get_input("outputPath")
        full_path = output_path.name

        if os.path.exists(full_path):
            if self.get_input("overwrite"):
                try:
                    if os.path.isfile(full_path):
                        os.remove(full_path)
                    else:
                        shutil.rmtree(full_path)
                except OSError, e:
                    msg = ('Could not delete existing path "%s" '
                           '(overwrite on)' % full_path)
                    raise ModuleError(
                            self,
                            '%s\n%s' % (msg, format_exception(e)))
            else:
                msg = ('Could not write to existing path "%s" '
                       '(overwrite off)' % full_path)
                raise ModuleError(self, msg)
            
        try:
            shutil.copytree(input_dir.name, full_path)
        except OSError, e:
            msg = 'Could not copy path from "%s" to "%s"' % \
                (input_dir.name, full_path)
            raise ModuleError(self, '%s\n%s' % (msg, format_exception(e)))

##############################################################################
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/core/modules/basic_modules.py/DirectorySink.compute/original