summaryrefslogtreecommitdiff
path: root/2.3-1/macros/GeneralFunctions/SCI2Cfileexist.sci
blob: 05dbf5904e8427d8f7191f2f778308f957ddf022 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function ExistTest = SCI2Cfileexist(InDir,FileName)
// function ExistTest = SCI2Cfileexist(InDir,FileName)
// -----------------------------------------------------------------
// Searches for the file FileName in the directory InDir.
// Return %F if it doesn't exist.
//
// Input data:
// //NUT: add description here
//
// Output data:
// //NUT: add description here
//
// Status:
// 12-Jun-2007 -- Nutricato Raffaele: Author.
//
// Copyright 2007 Raffaele Nutricato.
// Contact: raffaele.nutricato@tiscali.it
// -----------------------------------------------------------------

// ------------------------------
// --- Check input arguments. ---
// ------------------------------
SCI2CNInArgCheck(argn(2),2,2);

tmppwd = pwd();
cd(InDir);
allfiles = ls(FileName);
cd(tmppwd);

if (size(allfiles,1) == 0)
   ExistTest = %F;
elseif (size(allfiles,1) == 1)
   ExistTest = %T;
else
   SCI2Cerror('Very Strange! Found more than one file with the same name.');
end

endfunction