Mercurial > octave-nkf
comparison scripts/miscellaneous/movefile.m @ 10549:95c3e38098bf
Untabify .m scripts
author | Rik <code@nomad.inbox5.com> |
---|---|
date | Fri, 23 Apr 2010 11:28:50 -0700 |
parents | 3422f39573b1 |
children | 4ecc7bc5bc83 |
comparison
equal
deleted
inserted
replaced
10548:479536c5bb10 | 10549:95c3e38098bf |
---|---|
82 p2 = tilde_expand (f2); | 82 p2 = tilde_expand (f2); |
83 | 83 |
84 if (isdir && length(p1) > max_cmd_line) | 84 if (isdir && length(p1) > max_cmd_line) |
85 l2 = length(p2) + length (cmd) + 6; | 85 l2 = length(p2) + length (cmd) + 6; |
86 while (! isempty(f1)) | 86 while (! isempty(f1)) |
87 p1 = sprintf ("\"%s\" ", f1{1}); | 87 p1 = sprintf ("\"%s\" ", f1{1}); |
88 f1(1) = []; | 88 f1(1) = []; |
89 while (!isempty (f1) && (length(p1) + length(f1{1}) + l2 < | 89 while (!isempty (f1) && (length(p1) + length(f1{1}) + l2 < |
90 max_cmd_line)) | 90 max_cmd_line)) |
91 p1 = sprintf ("%s\"%s\" ", p1, f1{1}); | 91 p1 = sprintf ("%s\"%s\" ", p1, f1{1}); |
92 f1(1) = []; | 92 f1(1) = []; |
93 endwhile | 93 endwhile |
94 | 94 |
95 if (ispc () && ! isunix () && ! isempty (file_in_path (EXEC_PATH, "cp.exe"))) | 95 if (ispc () && ! isunix () && ! isempty (file_in_path (EXEC_PATH, "cp.exe"))) |
96 p1 = strrep (p1, "\\", "/"); | 96 p1 = strrep (p1, "\\", "/"); |
97 p2 = strrep (p2, "\\", "/"); | 97 p2 = strrep (p2, "\\", "/"); |
98 endif | 98 endif |
99 | 99 |
100 ## Move the file(s). | 100 ## Move the file(s). |
101 [err, msg] = system (sprintf ("%s %s \"%s\"", cmd, p1, p2)); | 101 [err, msg] = system (sprintf ("%s %s \"%s\"", cmd, p1, p2)); |
102 if (err < 0) | 102 if (err < 0) |
103 status = false; | 103 status = false; |
104 msgid = "movefile"; | 104 msgid = "movefile"; |
105 endif | 105 endif |
106 endwhile | 106 endwhile |
107 else | 107 else |
108 if (ispc () && ! isunix () && ! isempty (file_in_path (EXEC_PATH, "cp.exe"))) | 108 if (ispc () && ! isunix () && ! isempty (file_in_path (EXEC_PATH, "cp.exe"))) |
109 p1 = strrep (p1, "\\", "/"); | 109 p1 = strrep (p1, "\\", "/"); |
110 p2 = strrep (p2, "\\", "/"); | 110 p2 = strrep (p2, "\\", "/"); |
111 endif | 111 endif |
112 | 112 |
113 ## Move the file(s). | 113 ## Move the file(s). |
114 [err, msg] = system (sprintf ("%s %s \"%s\"", cmd, p1, p2)); | 114 [err, msg] = system (sprintf ("%s %s \"%s\"", cmd, p1, p2)); |
115 if (err < 0) | 115 if (err < 0) |
116 status = false; | 116 status = false; |
117 msgid = "movefile"; | 117 msgid = "movefile"; |
118 endif | 118 endif |
119 endif | 119 endif |
120 else | 120 else |
121 print_usage (); | 121 print_usage (); |
122 endif | 122 endif |