Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.4.0 - English

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

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab help >> Files : Input/Output functions > Paths - Filenames > pathconvert

pathconvert

pathnames convertion between POSIX and Windows.

Calling Sequence

paths = pathconvert(paths [,flagtrail [,flagexpand [,type]]])

Arguments

paths

a string matrix giving a set of pathnames

flagtrail

a boolean optional parameter. Its default value is %t.

flagexpand

a boolean optional parameter. Its default value depends on the result of getos() == 'Windows'.

type

a string 'u' or 'w'.

Description

pathconvert can be used to convert a set of pathnames (given by a string matrix paths) from Windows native filename to POSIX-style pathnames and back. The target style is given by the optional string type which can be 'u' for Unix or 'w' for Windows. The default style is set according to the value of getos() == 'Windows'. If getos() == 'Windows' is %t (resp. %f ) then default type is 'w' (resp. 'u').

Windows pathnames starting with name: are converted to pathnames starting with /cygdrive/name/ using the cygwin convention.

flagtrail is an optional boolean parameter. When its value is %t (default value) a trailing separator ('\' or '/') is added at the end of the path if it was missing. If flagtrail is set to %f, the trailing separator is removed.

flagexpand is an optional boolean parameter. When its value is %t leading strings like HOME, SCI or ~ are expanded using environment variables.

Examples

pathconvert("SCI/modules/fileio\macros/foo.sci",%f,%f,"u")
pathconvert("SCI/modules/fileio\macros/foo.sci",%f,%f,"w")
pathconvert("SCI/modules/fileio/macros/foo.sci",%f,%t,"w")
pathconvert("HOME/modules/fileio/macros/foo.sci",%t,%t,"w")
pathconvert("c:/tmp",%f,%t,"u")
pathconvert("/cygdrive/c/tmp",%f,%f,"w")

See Also

Report an issue
<< getshortpathname Paths - Filenames pathsep >>

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 Oct 01 17:34:52 CEST 2012