'Delete all the GRR temp files in path.
If path is a directory, look in the top level for filenames beginning with
Client.tempfile_prefix, and delete them.
If path is a regular file and starts with Client.tempfile_prefix delete it.
Args:
args: pathspec pointing to directory containing temp files to be
deleted, or a single file to be deleted.
Returns:
deleted: array of filename strings that were deleted
Raises:
ErrorBadPath: if path doesn\'t exist or is not a regular file or directory'

def Run(self, args):

    allowed_temp_dirs = [GetTempDirForRoot(root) for root in config.CONFIG['Client.tempdir_roots']]
    if args.path:
        paths = [client_utils.CanonicalPathToLocalPath(utils.NormalizePath(args.path))]
    else:
        paths = allowed_temp_dirs
    deleted = []
    errors = []
    for path in paths:
        if os.path.isdir(path):
            for filename in os.listdir(path):
                abs_filename = os.path.join(path, filename)
                try:
                    DeleteGRRTempFile(abs_filename)
                    deleted.append(abs_filename)
                except Exception as e:
                    errors.append(e)
        elif os.path.isfile(path):
            DeleteGRRTempFile(path)
            deleted = [path]
        elif (path not in allowed_temp_dirs):
            if (not os.path.exists(path)):
                raise ErrorBadPath(('File    %s    does    not    exist' % path))
            else:
                raise ErrorBadPath(('Not    a    regular    file    or    directory:    %s' % path))
    reply = ''
    if deleted:
        reply = ('Deleted:    %s.' % deleted)
    else:
        reply = 'Nothing    deleted.'
    if errors:
        reply += ('\n%s' % errors)
    self.SendReply(rdf_client.LogMessage(data=reply))
