Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.1 - Français

Change language to:
English - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
However, this page did not exist in the previous stable version.

Aide de Scilab >> Entrées/Sorties [fichiers] > Chemins - nom de fichiers > dirname

dirname

gets directory from filenames (obsolete)

Syntax

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(…) is obsolete and will be removed from Scilab 6.1.x. Please use fileparts(…) instead.

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

  • fileparts — returns the path, filename and extension for a file path
  • basename — strip directory and suffix from filenames
  • listfiles — list of files
  • pathconvert — converts a path to an OS path format.

History

VersionDescription
6.0.2 dirname() is tagged obsolete, to be removed from Scilab 6.1.x. fileparts() replaces it.
Report an issue
<< basename Chemins - nom de fichiers fileext >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Jan 03 14:33:07 CET 2022