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

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

Please note that the recommended version of Scilab is 2024.1.0. 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


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
Report an issue
<< getlongpathname Chemins - nom de fichiers getshortpathname >>

Copyright (c) 2022-2023 (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:
Tue Feb 25 08:50:26 CET 2020