23 #if defined (HAVE_CONFIG_H)
78 error (
"%s: %s", newdir.c_str (), std::strerror (errno));
80 Vlast_chdir_time.
stamp ();
134 std::string dirname =
args(0).xstring_value (
"cd: DIR must be a string");
136 if (! dirname.empty ())
143 if (! home_dir.empty ())
177 if (
args.length () != 1)
180 std::string dirname =
args(0).xstring_value (
"readdir: DIR must be a string");
212 if (nargin < 1 || nargin > 2)
219 std::string parent =
args(0).xstring_value (
"mkdir: PARENT must be a string");
220 std::string dir =
args(1).xstring_value (
"mkdir: DIR must be a string");
224 else if (nargin == 1)
225 dirname =
args(0).xstring_value (
"mkdir: DIR must be a string");
234 return ovl (
true,
"directory exists",
"mkdir");
243 return ovl (
false, msg,
"mkdir");
245 return ovl (
true,
"",
"");
267 int nargin =
args.length ();
269 if (nargin < 1 || nargin > 2)
272 std::string dirname =
args(0).xstring_value (
"rmdir: DIR must be a string");
280 if (
args(1).string_value () !=
"s")
281 error (
"rmdir: second argument must be \"s\" for recursive removal");
285 if (octave::application::interactive ()
286 && ! octave::application::forced_interactive ()
287 && Vconfirm_recursive_rmdir)
289 std::string prompt =
"remove entire contents of " + fulldir +
"? ";
301 return ovl (
false, msg,
"rmdir");
303 return ovl (
true,
"",
"");
318 if (
args.length () != 2)
321 std::string from =
args(0).xstring_value (
"link: OLD must be a string");
332 return ovl (-1.0, msg);
334 return ovl (status,
"");
349 if (
args.length () != 2)
352 std::string from =
args(0).xstring_value (
"symlink: OLD must be a string");
353 std::string to =
args(1).xstring_value (
"symlink: NEW must be a string");
363 return ovl (-1.0, msg);
365 return ovl (status,
"");
381 if (
args.length () != 1)
393 return ovl (
"", -1.0, msg);
395 return ovl (result, status,
"");
410 if (
args.length () != 2)
413 std::string from =
args(0).xstring_value (
"rename: OLD must be a string");
414 std::string to =
args(1).xstring_value (
"rename: NEW must be a string");
424 return ovl (-1.0, msg);
426 return ovl (status,
"");
480 if (
args.length () != 1)
483 string_vector pat =
args(0).xstring_vector_value (
"glob: PATTERN must be a string");
547 if (
args.length () == 0)
607 if (
args.length () != 2)
631 int nargin =
args.length ();
642 std::string s =
args(0).xstring_value (
"filesep: argument must be a string");
644 error (
"filesep: argument must be \"all\"");
660 int nargin =
args.length ();
667 if (
nargout > 0 || nargin == 0)
672 std::string sval =
args(0).xstring_value (
"pathsep: argument must be a single character");
674 switch (sval.length ())
685 error (
"pathsep: argument must be a single character");
static std::string dir_sep_str(void)
static std::string get_current_directory(void)
OCTINTERP_API octave_value_list Flink(const octave_value_list &=octave_value_list(), int=0)
static bool chdir(const std::string &newdir)
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).is_integer_type())
OCTINTERP_API void print_usage(void)
static void change_directory(const std::string &dir)
static std::string dir_sep_chars(void)
int symlink(const std::string &old_name, const std::string &new_name)
static int octave_change_to_directory(const std::string &newdir)
OCTINTERP_API octave_value_list Frmdir(const octave_value_list &=octave_value_list(), int=0)
OCTINTERP_API octave_value_list Freadlink(const octave_value_list &=octave_value_list(), int=0)
OCTINTERP_API octave_value_list Frename(const octave_value_list &=octave_value_list(), int=0)
#define DEFUN(name, args_name, nargout_name, doc)
void error(const char *fmt,...)
#define SET_INTERNAL_VARIABLE(NM)
OCTINTERP_API octave_value_list Fsymlink(const octave_value_list &=octave_value_list(), int=0)
static bool Vconfirm_recursive_rmdir
static std::string tilde_expand(const std::string &)
int recursive_rmdir(const std::string &name)
int rename(const std::string &from, const std::string &to)
#define DEFALIAS(alias, name)
string_vector windows_glob(const string_vector &pat)
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
static std::string get_home_directory(void)
int link(const std::string &old_name, const std::string &new_name)
static char path_sep_char(void)
#define DEFUNX(name, fname, args_name, nargout_name, doc)
string_vector & sort(bool make_uniq=false)
may be zero for pure relative error test tem the relative tolerance must be greater than or equal to
octave::sys::time Vlast_chdir_time
With real return the complex result
static std::string concat(const std::string &, const std::string &)
static std::string path_sep_str(void)
int mkdir(const std::string &nm, mode_t md)
int rmdir(const std::string &name)
is longer than or if then or only for unique occurrences of the complete pattern(false).The default is true.If a cell array of strings ar
int chdir(const std::string &path_arg)
int readlink(const std::string &path, std::string &result)
octave::sys::file_stat fs(filename)
std::string error(void) const
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
string_vector glob(const string_vector &pat)
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))