# dirname

gets directory from filenames

## Calling Sequence

    dirs = dirname(files[, flag [,flagexpand]])

## Arguments

files

  a string matrix containing file paths

flag

  optional boolean, used to convert the given path(s) for the current operating system. Default value is true (`%t`).

flagexpand

  optional boolean, used to expand leading variables in paths. Only used with `flag` argument. Default value is true (`%t`).

dirs

  string matrices

## Description

`dirname` returns the directory paths of the file entries given in `files`.

If `flag` is true the paths are first converted for the current operating system (for example, `C:/Tmp/folder'` will be converted on Windows to `'C:\Tmp\folder'`).

If `flagexpand` is true, leading path variables (`home`, `SCI`, `SCIHOME`, ...) are expanded for the current operating system (for example, `'home\tmp'` will be converted on GNU/Linux to `'home/<user>/tmp'`, where `<user>` is the current user logged on).

See more details on `flag` and `flagexpand` in pathconvert section.

## Examples

    dirs=dirname('/tmp/folder/poo')
    dirs=dirname('/tmp/folder/')
    dirs=dirname('/')

    dirs=dirname('C:\tmp\folder\poo')
    dirs=dirname('C:\tmp\folder\')
    dirs=dirname('C:\')

    dirs=dirname(['SCI/etc/scilab.start', 'SCI/etc/scilab.quit'])

## See Also

- basename
- listfiles
- pathconvert