fileinfo

Purpose

Returns names and information for files that match a specification.

Format

{ fnames, finfo } = fileinfo(fspec)
Parameters:

fspec (string) – file specification. Can include path and wildcards.

Returns:
  • fnames (Nx1 string array) – all file names that match, null string if none are found.

  • finfo (Nx13 matrix) –

    information about matching files.

    Linux

    \([N, 1]\)

    filesystem ID

    \([N, 2]\)

    inode number

    \([N, 3]\)

    mode bit mask

    \([N, 4]\)

    number of links

    \([N, 5]\)

    user ID

    \([N, 6]\)

    group ID

    \([N, 7]\)

    device ID (char/block special files only)

    \([N, 8]\)

    size in bytes

    \([N, 9]\)

    last access time

    \([N,10]\)

    last data modification time

    \([N,11]\)

    last file status change time

    \([N,12]\)

    preferred I/O block size

    \([N,13]\)

    number of 512-byte blocks allocated

    Windows

    \([N, 1]\)

    drive number (A = 0, B = 1, etc.)

    \([N, 2]\)

    n/a, 0

    \([N, 3]\)

    mode bit mask

    \([N, 4]\)

    number of links, always 1

    \([N, 5]\)

    n/a, 0

    \([N, 6]\)

    n/a, 0

    \([N, 7]\)

    n/a, 0

    \([N, 8]\)

    size in bytes

    \([N, 9]\)

    last access time

    \([N,10]\)

    last data modification time

    \([N,11]\)

    creation time

    \([N,12]\)

    n/a, 0

    \([N,13]\)

    n/a, 0

    finfo will be a scalar zero if no matches are found.

Examples

{ fnames, finfo} = fileinfo("fourier_*");

// Print results
print "File names"; fnames;
print "File information"; finfo;

This prints results about all files starting with fourier_ in the current working directory:

File names

fourier_adf.e
fourier_adf_rev.e
fourier_adf_turkish.e

File information

2.00   0.00 33206.00   1.00   0.00   0.00   0.00 1270.00 1559719168.00 1559719168.00 1559718437.00   0.00   0.00
2.00   0.00 33206.00   1.00   0.00   0.00   0.00 1270.00 1559719236.00 1559719236.00 1559719236.00   0.00   0.00
2.00   0.00 33206.00   1.00   0.00   0.00   0.00 1277.00 1562820073.00 1562820073.00 1562820032.00   0.00   0.00

Remarks

fnames will contain file names only; any path information that was passed is dropped.

The time stamp fields (finfo[N, 9:11]) are expressed as the number of seconds since midnight, Jan. 1, 1970, Coordinated Universal Time (UTC).

See also

Functions filesa()