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


getrelativefilename

given absolute directories and absolute filenames, returns relative file names

Syntax

rel_file = getrelativefilename(abs_dir, abs_file)

Arguments

abs_dir

a character string or matrix of character strings: absolute directories.

abs_file

a character string or matrix of character strings: absolute filenames.

rel_file

a character string or a matrix of character strings: relative filenames.

Description

Given absolute directories abs_dir and absolute filenames abs_file, getrelativefilename returns relative file names rel_file. That is, if the input arguments are some string matrices (m x n), for indexes (i, j), getrelativefilename returns rel_file(i,j) associated with abs_dir(i,j) and abs_file(i,j). This implies that abs_dir and abs_file must have the same dimensions.

For example, if the current directory is C:\scilab\bin and the filename C:\scilab\modules\helptools\readme.txt is given, getrelativefilename will return ..\modules\helptools\readme.txt.

Examples

getrelativefilename(pwd(), SCI+'/COPYING')
getrelativefilename(TMPDIR, SCI+'/COPYING')
getrelativefilename(SCI+'/bin', SCI+'/COPYING')
getrelativefilename(pwd(), SCI+'/ACKNOWLEDGMENTS')
getrelativefilename(TMPDIR, SCI+'/ACKNOWLEDGMENTS')
getrelativefilename(SCI+'/bin', SCI+'/ACKNOWLEDGMENTS')
getrelativefilename([SCI+'/bin',SCI+'/bin'], [SCI+'/ACKNOWLEDGMENTS',SCI+'/ACKNOWLEDGMENTS'])

See also

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

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 Jun 17 17:49:16 CEST 2024