Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: Français - Português - 日本語 - Русский
Scilab Help >> Files : Input/Output functions > Paths - Filenames > getrelativefilename


given absolute directories and absolute filenames, returns relative file names


rel_file = getrelativefilename(abs_dir, abs_file)



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


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


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


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.


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

Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Jan 03 14:23:28 CET 2022