diff scripts/miscellaneous/copyfile.m @ 6069:67b1a61a85ce

[project @ 2006-10-21 14:33:53 by jwe]
author jwe
date Sat, 21 Oct 2006 14:33:54 +0000
parents 176f1c58a474
children 2eb0723b4fad
line wrap: on
line diff
--- a/scripts/miscellaneous/copyfile.m	Fri Oct 20 16:54:30 2006 +0000
+++ b/scripts/miscellaneous/copyfile.m	Sat Oct 21 14:33:54 2006 +0000
@@ -42,7 +42,15 @@
     else
       cmd = "/bin/cp -r";
     endif
-    [err, msg] = system (sprintf ("%s %s %s", cmd, f1, f2));
+
+    ## Allow cell input and protect the file name(s).
+    if (iscellstr (f1))
+      f1 = sprintf("\"%s\" ", f1{:});
+    else
+      f1 = sprintf("\"%s\" ", f1);
+    endif
+
+    [err, msg] = system (sprintf ("%s %s \"%s\"", cmd, f1, f2));
     if (err < 0)
       status = false;
       msgid = "copyfile";