# 6.7.1 SHOW FILE VALIDITY

Part of: [6 Language](6-language.md) › [6.7 Data Introspection Language (DIL)](6-7-data-introspection-language-dil.md)

### Syntax

**SHOW** **FILE** **VALIDITY** _file_name_ [**,** _file_name_]\* [**BY** **NAME**]\
[_post_processing_option_]\
[_output_redirecting_option_]

### Description

Show (i.e. get) the validity of a file named _file_name_ (i.e. whether it is a valid HDF5 file or not). Multiple files can be checked at once for their validity by separating their names with a comma (,). If _file_name_ was not found or its validity could not be obtained (due to unknown/unexpected reasons), no subsequent files are checked, and an error is raised.

### Parameter(s)

_file_name_ – mandatory string that specifies the name of the file whose validity is to be obtained.

_post_processing_option_ – optional option that transforms the result set according to the programmer’s needs, such as ordering or truncating (please refer to the section [PROCESSING](6-2-processing.md) for additional information).

_output_redirecting_option_ – optional option that specifies the cursor in use, an HDF5 object (i.e. dataset or attribute), a (text, binary, or Excel) file, or memory (i.e. user-defined variable) to write the result set into (please refer to the subsection [INTO](6-3-2-into.md) for additional information). If not specified, the cursor in use is populated with the result set instead (please refer to the chapter [CURSOR](4-cursor.md) for additional information).

### Return

If the keyword BY NAME is not specified, it returns the validity of a file as an [HDFQL_INT](5-1-constants.md#hdfql_int), which can either be [HDFQL_YES](5-1-constants.md#hdfql_yes) or [HDFQL_NO](5-1-constants.md#hdfql_no) depending on whether the file is a valid HDF5 file or not, respectively. Otherwise, if the keyword BY NAME is specified, it returns the validity of a file as an [HDFQL_VARCHAR](5-1-constants.md#hdfql_varchar), which can either be “YES” or “NO”.

### Example(s)

```hdfql
# create an HDF5 file named "my_file.h5" 
CREATE FILE my_file.h5

# show (i.e. get) validity of file "my_file.h5" (should return 0 (i.e. HDFQL_YES)) 
SHOW FILE VALIDITY my_file.h5

# show (i.e. get) validity of a file named "not_an_hdf5_file.xml" (should return -1 (i.e. HDFQL_NO)) (assuming that the file "not_an_hdf5_file.xml" exists and contains XML text)
SHOW FILE VALIDITY not_an_hdf5_file.xml

# show (i.e. get) validity of both files "my_file.h5" and "not_an_hdf5_file.xml" at once (should return 0, -1)
SHOW FILE VALIDITY my_file.h5, not_an_hdf5_file.xml

# show (i.e. get) validity of both files "my_file.h5" and "not_an_hdf5_file.xml" at once by name (should return "YES", "NO")
SHOW FILE VALIDITY my_file.h5, not_an_hdf5_file.xml BY NAME
```
