다음: File Archiving Utilities, 이전: Timing Utilities, 상위 문서: System Utilities [차례][찾아보기]
Octave includes many utility functions for copying, moving, renaming, and deleting files; for creating, reading, and deleting directories; for retrieving status information on files; and for manipulating file and path names.
Move the source file or directory f1 to the destination f2.
The name f1 may contain globbing patterns, or may be a cell array of strings. If f1 expands to multiple filenames, f2 must be a directory.
If no destination f2 is specified then the destination is the present working directory. If f2 is a filename then f1 is renamed to f2.
When the force flag 'f'
is given any existing files will be
overwritten without prompting.
If successful, 상태 is 1, and 안내, 안내_식별자 are empty
character strings (""). Otherwise, 상태 is 0, 안내 contains a
system-dependent error message, and 안내_식별자 contains a unique message
identifier. Note that the status code is exactly opposite that of the
system
command.
Change the name of file old to new.
If successful, 오류 is 0 and 안내 is an empty string. Otherwise, 오류 is nonzero and 안내 contains a system-dependent error message.
Copy the source file(s) or directory f1 to the destination f2.
The name f1 may contain globbing patterns, or may be a cell array of strings. If f1 expands to multiple filenames, f2 must be a directory.
When the force flag 'f'
is given any existing files will be
overwritten without prompting.
If successful, 상태 is 1, and 안내, 안내_식별자 are empty
character strings (""). Otherwise, 상태 is 0, 안내 contains a
system-dependent error message, and 안내_식별자 contains a unique message
identifier. Note that the status code is exactly opposite that of the
system
command.
Delete the file named 기록철.
If successful, 오류 is 0 and 안내 is an empty string. Otherwise, 오류 is nonzero and 안내 contains a system-dependent error message.
Create a new link (also known as a hard link) to an existing file.
If successful, 오류 is 0 and 안내 is an empty string. Otherwise, 오류 is nonzero and 안내 contains a system-dependent error message.
Create a symbolic link new which contains the string old.
If successful, 오류 is 0 and 안내 is an empty string. Otherwise, 오류 is nonzero and 안내 contains a system-dependent error message.
Read the value of the symbolic link symlink.
If successful, result contains the contents of the symbolic link symlink, 오류 is 0, and 안내 is an empty string. Otherwise, 오류 is nonzero and 안내 contains a system-dependent error message.
Create a directory named 자료방_이름 in the directory parent, creating any intermediate directories if necessary.
If 자료방_이름 is a relative path, and no parent directory is specified, then the present working directory is used.
If successful, 상태 is 1, and 안내 and 안내_식별자 are empty strings (""). Otherwise, 상태 is 0, 안내 contains a system-dependent error message, and 안내_식별자 contains a unique message identifier.
When creating a directory permissions will be set to
0777 - UMASK
.
Remove the directory named 자료방.
If the optional second parameter is supplied with value "s"
,
recursively remove all subdirectories as well.
If successful, 상태 is 1, and 안내, 안내_식별자 are empty character strings (""). Otherwise, 상태 is 0, 안내 contains a system-dependent error message, and 안내_식별자 contains a unique message identifier.
같이 보기: mkdir, confirm_recursive_rmdir, pwd.
Query or set the internal variable that controls whether Octave will ask for confirmation before recursively removing a directory tree.
함수 안에서 "local"
선택지를 넣어 부르면, 함수와 함수가 부른 종속 절차의 변수가 지역적으로 바뀝니다. 함수가 종료되면 원래 변숫값이 되돌아옵니다.
같이 보기: rmdir.
Create a FIFO special file named 이름 with file mode 방식.
방식 is interpreted as an octal number and is subject to umask
processing. The final calculated mode is 방식 - umask
.
If successful, 오류 is 0 and 안내 is an empty string. Otherwise, 오류 is nonzero and 안내 contains a system-dependent error message.
Set the permission mask for file creation.
The parameter mask is an integer, interpreted as an octal number.
If successful, returns the previous value of the mask (as an integer to be interpreted as an octal number); otherwise an error message is printed.
The permission mask is a UNIX concept used when creating new objects on a
file system such as files, directories, or named FIFOs. The object to be
created has base permissions in an octal number 방식 which are
modified according to the octal value of mask. The final permissions
for the new object are 방식 - mask
.
Return a structure info containing the following information about 기록철 or file identifier 기록철_식별자.
dev
ID of device containing a directory entry for this file.
ino
File number of the file.
mode
File mode, as an integer. Use the functions S_ISREG
,
S_ISDIR
, S_ISCHR
, S_ISBLK
,
S_ISFIFO
, S_ISLNK
, or S_ISSOCK
to extract
information from this value.
modestr
File mode, as a string of ten letters or dashes as would be returned by ls -l.
nlink
Number of links.
uid
User ID of file’s owner.
gid
Group ID of file’s group.
rdev
ID of device for block or character special files.
size
Size in bytes.
atime
Time of last access in the same form as time values returned from
time
. See Timing Utilities.
mtime
Time of last modification in the same form as time values returned from
time
. See Timing Utilities.
ctime
Time of last file status change in the same form as time values
returned from time
. See Timing Utilities.
blksize
Size of blocks in the file.
blocks
Number of blocks allocated for file.
If the call is successful 오류 is 0 and 안내 is an empty string. If the file does not exist, or some other error occurs, info is an empty matrix, 오류 is -1, and 안내 contains the corresponding system error message.
If 기록철 is a symbolic link, stat
will return information about
the actual file that is referenced by the link. Use lstat
if you
want information about the symbolic link itself.
For example:
[info, err, msg] = stat ("/vmlinuz") ⇒ info = { atime = 855399756 rdev = 0 ctime = 847219094 uid = 0 size = 389218 blksize = 4096 mtime = 847219094 gid = 6 nlink = 1 blocks = 768 mode = -rw-r--r-- modestr = -rw-r--r-- ino = 9316 dev = 2049 } ⇒ err = 0 ⇒ msg =
Return true if 방식 corresponds to a block device.
The value of 방식 is assumed to be returned from a call to
stat
.
Return true if 방식 corresponds to a character device.
The value of 방식 is assumed to be returned from a call to
stat
.
Return true if 방식 corresponds to a directory.
The value of 방식 is assumed to be returned from a call to
stat
.
Return true if 방식 corresponds to a fifo.
The value of 방식 is assumed to be returned from a call to
stat
.
Return true if 방식 corresponds to a symbolic link.
The value of 방식 is assumed to be returned from a call to
stat
.
Return true if 방식 corresponds to a regular file.
The value of 방식 is assumed to be returned from a call to
stat
.
Return true if 방식 corresponds to a socket.
The value of 방식 is assumed to be returned from a call to
stat
.
Return information about 기록철.
If successful, 상태 is 1 and 안내 is a structure with the following fields:
Name
Full name of 기록철.
archive
True if 기록철 is an archive (Windows).
system
True if 기록철 is a system file (Windows).
hidden
True if 기록철 is a hidden file (Windows).
directory
True if 기록철 is a directory.
UserRead
GroupRead
OtherRead
True if the user (group; other users) has read permission for 기록철.
UserWrite
GroupWrite
OtherWrite
True if the user (group; other users) has write permission for 기록철.
UserExecute
GroupExecute
OtherExecute
True if the user (group; other users) has execute permission for 기록철.
If an attribute does not apply (i.e., archive on a Unix system) then the field is set to NaN.
If attrib
fails, 안내 is a non-empty string containing an
error message and msg_id is the non-empty string "fileattrib"
.
With no input arguments, return information about the current directory.
If 기록철 contains globbing characters, return information about all the matching files.
같이 보기: glob.
Return true if f is a regular file and false otherwise.
If f is a cell array of strings, tf is a logical array of the same size.
같이 보기: isfolder, exist, stat, is_absolute_filename, is_rooted_relative_filename.
This function is not recommended. Use isfolder
or
file_in_loadpath
instead.
Return true if f is a directory and false otherwise.
Compatibility Note: The 매트랩 function of the same name will also search for f in the load path directories. To emulate this behavior use
tf = ! isempty (file_in_loadpath (f))
같이 보기: isfolder, file_in_loadpath, exist, stat, is_absolute_filename, is_rooted_relative_filename.
Return true if f is a directory and false otherwise.
If f is a cell array of strings, tf is a logical array of the same size.
같이 보기: isfile, exist, stat, is_absolute_filename, is_rooted_relative_filename.
Return the names of files in the directory 자료방 as a cell array of strings.
If an error occurs, return an empty cell array in files. If successful, 오류 is 0 and 안내 is an empty string. Otherwise, 오류 is nonzero and 안내 contains a system-dependent error message.
Given an array of pattern strings (as a char array or a cell array) in 양상, return a cell array of filenames that match any of them, or an empty cell array if no patterns match.
The pattern strings are interpreted as filename globbing patterns (as they are used by Unix shells).
Within a pattern
*
matches any string, including the null string,
?
matches any single character, and
[…]
matches any of the enclosed characters.
Tilde expansion is performed on each of the patterns before looking for matching filenames. For example:
ls ⇒ file1 file2 file3 myfile1 myfile1b glob ("*file1") ⇒ { [1,1] = file1 [2,1] = myfile1 } glob ("myfile?") ⇒ { [1,1] = myfile1 } glob ("file[12]") ⇒ { [1,1] = file1 [2,1] = file2 }
Return the absolute name of 기록철 if it can be found in path.
The value of path should be a colon-separated list of directories in
the format described for 경로
. If no file is found, return an empty
character string. For example:
file_in_path (EXEC_PATH, "sh") ⇒ "/bin/sh"
If the second argument is a cell array of strings, search each directory of the path for element of the cell array and return the first that matches.
If the third optional argument "all"
is supplied, return a cell
array containing the list of all files that have the same name in the path.
If no files are found, return an empty cell array.
같이 보기: file_in_loadpath, dir_in_loadpath, path.
Return the system-dependent character used to separate directory names.
If "all"
is given, the function returns all valid file separators
in the form of a string. The list of file separators is system-dependent.
It is ‘/’ (forward slash) under UNIX or Mac OS X, ‘/’ and
‘\’ (forward and backward slashes) under Windows.
같이 보기: pathsep.
Return the directory, name, and extension components of 기록철_이름.
The input 기록철_이름 is a string which is parsed. There is no attempt to check whether the filename or directory specified actually exists.
Build complete filename from separate parts.
Joins any number of path components intelligently. The return value is the concatenation of each component with exactly one file separator between each non empty part and at most one leading and/or trailing file separator.
If the last component part is a cell array, returns a cell array of filepaths, one for each element in the last component, e.g.:
fullfile ("/home/username", "data", {"f1.csv", "f2.csv", "f3.csv"}) ⇒ { [1,1] = /home/username/data/f1.csv [1,2] = /home/username/data/f2.csv [1,3] = /home/username/data/f3.csv }
On Windows systems, while forward slash file separators do work, they are replaced by backslashes; in addition drive letters are stripped of leading file separators to obtain a valid file path.
Note: fullfile
does not perform any validation of the resulting full
filename.
Perform tilde expansion on 문자열.
If 문자열 begins with a tilde character, (‘~’), all of the characters preceding the first slash (or all characters, if there is no slash) are treated as a possible user name, and the tilde and the following characters up to the slash are replaced by the home directory of the named user. If the tilde is followed immediately by a slash, the tilde is replaced by the home directory of the user running Octave.
If the input is a cell array of strings cellstr then tilde expansion is performed on each string element.
Examples:
tilde_expand ("~joeuser/bin") ⇒ "/home/joeuser/bin" tilde_expand ("~/bin") ⇒ "/home/jwe/bin"
Return the canonical name of file 기록철_이름.
If the file does not exist the empty string ("") is returned.
같이 보기: make_absolute_filename, is_absolute_filename, is_rooted_relative_filename.
Return the full name of 기록철 beginning from the root of the file system.
No check is done for the existence of 기록철.
같이 보기: canonicalize_file_name, is_absolute_filename, is_rooted_relative_filename, isfolder.
Return true if 기록철 is an absolute filename.
같이 보기: is_rooted_relative_filename, make_absolute_filename, isfolder.
Return true if 기록철 is a rooted-relative filename.
같이 보기: is_absolute_filename, make_absolute_filename, isfolder.
Query or set the preference for recycling deleted files.
When recycling is enabled, commands which would permanently erase files instead move them to a temporary location (such as the directory labeled Trash).
Programming Note: This function is provided for 매트랩 compatibility, but recycling is not implemented in Octave. To help avoid accidental data loss an error will be raised if an attempt is made to enable file recycling.
다음: File Archiving Utilities, 이전: Timing Utilities, 상위 문서: System Utilities [차례][찾아보기]