Routines (alphabetical) > Routines: H > HDF Routines > HDF_SD_FILEINFO

# HDF_SD_FILEINFO

The HDF_SD_FILEINFO procedure retrieves the number of datasets and global attributes in an HDF file.

## Examples

; Start the SD interface:

SDinterface_id = HDF_SD_START('demo.hdf', /CREATE)

; Set a global attribute:

HDF_SD_ATTRSET,SDinterface_id, 'TITLE', 'MYTITLE'

; Set another one:

HDF_SD_ATTRSET,SDinterface_id, 'TITLE2', 'MYTITLE2'

; Create a dataset:

SDdataset_id = HDF_SD_CREATE(SDinterface_id, 'var1', [10,3])

; Retrieve info about the dataset:

HDF_SD_FILEINFO, SDinterface_id, datasets, attributes

; Print information about the returned variables:

HELP, datasets, attributes

; End SD access:

HDF_SD_ENDACCESS, SDdataset_id

; Close the SD interface:

HDF_SD_END, SDinterface_id

#### IDL Output

DATASETS LONG = 1

ATTRIBUTES LONG = 2

## Syntax

HDF_SD_FILEINFO, SDinterface_id, Datasets, Attributes

## Arguments

### SDinterface_id

An SD interface ID as returned by HDF_SD_START.

### Datasets

A named variable in which the total number of SD-type objects (i.e., the number of datasets + the number of dimensions) in the file is returned.

### Attributes

A named variable in which the number of global attributes in the file is returned.

## Keywords

None

## Version History

4.0 | Introduced

## See Also

HDF_SD_ATTRFIND, HDF_SD_ATTRINFO, HDF_SD_START