summaryrefslogtreecommitdiff
path: root/macros/GeneralFunctions/SCI2Cfileexist.sci
diff options
context:
space:
mode:
Diffstat (limited to 'macros/GeneralFunctions/SCI2Cfileexist.sci')
-rw-r--r--macros/GeneralFunctions/SCI2Cfileexist.sci38
1 files changed, 38 insertions, 0 deletions
diff --git a/macros/GeneralFunctions/SCI2Cfileexist.sci b/macros/GeneralFunctions/SCI2Cfileexist.sci
new file mode 100644
index 0000000..05dbf59
--- /dev/null
+++ b/macros/GeneralFunctions/SCI2Cfileexist.sci
@@ -0,0 +1,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