Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Português - 日本語 - Русский

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

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


given absolute directories and absolute filenames, returns relative file names

Calling Sequence

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

  • getshortpathname — retourne le chemin au format court (Seulement pour Windows)
  • getlongpathname — retourne le chemin au format nom long (Seulement pour Windows)
  • pwd — affiche le répertoire courant de Scilab
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Apr 01 10:21:42 CEST 2015