diff scripts/miscellaneous/copyfile.m @ 6210:12b676a0b183 before-graphics-branch

[project @ 2006-12-07 02:37:17 by jwe]
author jwe
date Thu, 07 Dec 2006 02:37:17 +0000
parents 2eb0723b4fad
children a299c8a6d96e
line wrap: on
line diff
--- a/scripts/miscellaneous/copyfile.m	Thu Dec 07 01:20:04 2006 +0000
+++ b/scripts/miscellaneous/copyfile.m	Thu Dec 07 02:37:17 2006 +0000
@@ -37,11 +37,20 @@
   msg = "";
   msgid = "";
 
+  ## FIXME -- maybe use the same method as in ls to allow users control
+  ## over the command that is executed.
+
+  if (ispc () && ! isunix () && isempty (file_in_path (EXEC_PATH, "cp")))
+    cmd = "cmd /C xcopy /E";
+    cmd_force_flag = "/Y";
+  else
+    cmd = "cp -r";
+    cmd_force_flag = "-f";
+  endif
+
   if (nargin == 2 || nargin == 3)
     if (nargin == 3 && strcmp (force, "f"))
-      cmd = "/bin/cp -rf";
-    else
-      cmd = "/bin/cp -r";
+      cmd = strcat (cmd, " ", cmd_force_flag);
     endif
 
     ## Allow cell input and protect the file name(s).