1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2008 - INRIA
7 * This file must be used under the terms of the CeCILL.
8 * This source file is licensed as described in the file COPYING, which
9 * you should have received as part of this distribution. The terms
10 * are also available at
11 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
14 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="basename" xml:lang="en">
16 <refname>basename</refname>
17 <refpurpose>strip directory and suffix from filenames</refpurpose>
20 <title>Calling Sequence</title>
21 <synopsis>processedfiles = basename(files[,flag [,flagexpand]])</synopsis>
24 <title>Arguments</title>
29 <para>a string matrix giving a set of file names.</para>
35 <para>optional boolean, used to convert the given path(s) for the current operating system.
36 Default value is true (<constant>%t</constant>).
41 <term>flagexpand</term>
43 <para>optional boolean, used to expand leading
44 variables in paths. Only used with
45 <varname>flag</varname> argument. Default value
46 is true (<constant>%t</constant>).
51 <term>processedFiles</term>
53 <para>a string matrix containing the processed filenames.</para>
59 <title>Description</title>
61 <code>basename(files)</code> returns the suffixs of paths, i.e. the last string following the final file separator for each path given in <varname>files</varname>.
64 If <varname>flag</varname> is true the paths are first converted for the current operating system (for example, 'C:/Tmp/folder' will be converted on Windows to 'C:\Tmp\folder').
67 if <varname>flagexpand</varname> is true, leading path variables (HOME, SCI, SCIHOME, ...) are expanded for the current operating system
68 (for example, 'HOME\tmp' will be converted on Linux to 'home/<user>/tmp', where <user> is the current user logged on).
71 See more details on <varname>flag</varname> and <varname>flagexpand</varname> in <link linkend="pathconvert">pathconvert</link> section.
75 <title>Examples</title>
76 <programlisting role="example"><![CDATA[
77 files=basename('/tmp/poo')
78 files=basename('/tmp/poo.sci')
79 files=basename('/tmp/poo.bak.sci')
80 files=basename('/tmp/')
82 files=basename('C:\tmp\poo')
83 files=basename('C:\tmp\poo.sci')
84 files=basename('C:\tmp\poo.bak.sci')
86 files=basename('C:\tmp\')
88 files=basename(['SCI/etc/scilab.start', 'SCI/etc/scilab.quit'])
91 <refsection role="see also">
92 <title>See Also</title>
93 <simplelist type="inline">
95 <link linkend="listfiles">listfiles</link>
98 <link linkend="pathconvert">pathconvert</link>
101 <link linkend="fileparts">fileparts</link>