Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
28
Добавлен:
09.02.2015
Размер:
407.04 Кб
Скачать

Input parameters:

FILE: 1 x n string, defining the file or directory. See NOTE 2.

MODE: space-delimited string, defining the mode of the file or

directory. See NOTE 3.

'a' : archive (Windows/DOS only).

'h' : hidden file (Windows/DOS only).

's' : system file (Windows/DOS only).

'w' : write access.

'x' : executable (UNIX only).

Either '+' or '-' must be added in front of each file mode to set

or clear an attribute.

USERS: space-delimited string, defining which users are

affected by the attribute setting. (UNIX only)

'a' : all users.

'g' : group of users.

'o' : other users.

'u' : current user.

Default attribute is dependent upon the UNIX umask.

MODIFIER: character scalar, modifying the behavior of FILEATTRIB.

's' : operate recursively on files and directories in the

directory subtree. See NOTE 4.

Default - MODIFIER is absent or the empty string.

RETURN PARAMETERS:

SUCCESS: logical scalar, defining the outcome of FILEATTRIB.

1 : FILEATTRIB executed successfully.

0 : an error occurred.

MESSAGE: structure array; when requesting attributes, defines file

attributes in terms of the following fields (see NOTE 5):

Name: string vector containing name of file or directory

archive: 0 or 1 or NaN

system: 0 or 1 or NaN

hidden: 0 or 1 or NaN

directory: 0 or 1 or NaN

UserRead: 0 or 1 or NaN

UserWrite: 0 or 1 or NaN

UserExecute: 0 or 1 or NaN

GroupRead: 0 or 1 or NaN

GroupWrite: 0 or 1 or NaN

GroupExecute: 0 or 1 or NaN

OtherRead: 0 or 1 or NaN

OtherWrite: 0 or 1 or NaN

OtherExecute: 0 or 1 or NaN

MESSAGE: string, defining the error or warning message.

empty string : FILEATTRIB executed successfully.

message : error or warning message, as applicable.

MESSAGEID: string, defining the error or warning identifier.

empty string : FILEATTRIB executed successfully.

message id: error or warning message identifier.

(see ERROR, Mexception, WARNING, LASTWARN).

EXAMPLES:

fileattrib mydir\* recursively displays the attributes of 'mydir'

and its contents.

fileattrib myfile -w -s sets the 'read-only' attribute and revokes

the 'system file' attribute of 'myfile'.

fileattrib 'mydir' -x revokes the 'executable' attribute of 'mydir'.

fileattrib mydir '-w -h' sets read-only and revokes hidden attributes

of 'mydir'.

fileattrib mydir -w a s revokes, for all users, the 'writable'

attribute from 'mydir' as well as its subdirectory tree.

fileattrib mydir +w '' s sets 'mydir', as well as its subdirectory tree,

writable.

fileattrib myfile '+w +x' 'o g' sets the 'writable' and 'executable'

attributes of 'myfile' for other users as well as group.

[SUCCESS,MESSAGE,MESSAGEID] = fileattrib('mydir\*'); if successful,

returns the success status 1 in SUCCESS, the attributes of 'mydir' and its

subdirectory tree in the structure array MESSAGE. If a warning was issued,

MESSAGE contains the warning, while MESSAGEID contains the warning message

identifier. In case of failure, SUCCESS contains success status 0, MESSAGE

contains the error message, and MESSAGEID contains the error message

identifier.

[SUCCESS,MESSAGE,MESSAGEID] = fileattrib('myfile','+w +x','o g') sets the

'writable' and 'executable' attributes of 'myfile' for other users as well

as group.

NOTE 1: When FILEATTRIB is called without return arguments and an error

has occurred while executing FILEATTRIB, the error message is

displayed.

NOTE 2: UNC paths are supported. The * wildcard, as a suffix to the last

name or the extension to the last name in a path string, is

supported.

NOTE 3: Operating system specific attribute modifiers apply; therefore

specifying invalid modifiers will result in error messages.

NOTE 4: On Windows 2000 and later: equivalent to ATTRIB switches /s /d.

NOTE 5: Attribute field values are type logical. NaN indicates that an

attribute is not defined for a particular operating system.

See also cd, copyfile, delete, dir, mkdir, movefile, rmdir.

Reference page in Help browser

doc fileattrib

<isdir> - True if argument is a directory.

ISDIR True if argument is a directory.

ISDIR(DIR) returns a 1 if DIR is a directory and 0 otherwise.

See also finfo, mkdir.

Reference page in Help browser

doc isdir

<mkdir> - Make new directory.

MKDIR Make new directory.

[SUCCESS,MESSAGE,MESSAGEID] = MKDIR(PARENTDIR,NEWDIR) makes a new

directory, NEWDIR, under the parent, PARENTDIR. While PARENTDIR may be

an absolute path, NEWDIR must be a relative path. When NEWDIR exists,

MKDIR returns SUCCESS = 1. If the number of output arguments is 1 or

less, it also issues a warning that the directory already exists.

[SUCCESS,MESSAGE,MESSAGEID] = MKDIR(NEWDIR) creates the directory

NEWDIR in the current directory, if NEWDIR represents a relative path.

Otherwise, NEWDIR represents an absolute path and MKDIR attempts to

create the absolute directory NEWDIR in the root of the current volume.

An absolute path starts in any one of a Windows drive letter, a UNC

path '\\' string or a UNIX '/' character.

INPUT PARAMETERS:

PARENTDIR: string specifying the parent directory. See NOTE 1.

NEWDIR: string specifying the new directory.

RETURN PARAMETERS:

SUCCESS: logical scalar, defining the outcome of MKDIR.

1 : MKDIR executed successfully. 0 : an error occurred.

MESSAGE: string, defining the error or warning message.

empty string : MKDIR executed successfully. message :

an error or warning message, as applicable.

MESSAGEID: string, defining the error or warning identifier.

empty string : MKDIR executed successfully. message id:

the MATLAB error or warning message identifier (see

ERROR, MException, WARNING, LASTWARN).

NOTE 1: UNC paths are supported.

See also cd, copyfile, delete, dir, fileattrib, movefile, rmdir.

Overloaded methods:

ftp/mkdir

Reference page in Help browser

doc mkdir

<rmdir> - Remove directory.

RMDIR Remove directory.

RMDIR(DIRECTORY) removes DIRECTORY from the parent directory, subject

to access rights. DIRECTORY must be empty.

RMDIR(DIRECTORY, 's') removes DIRECTORY, including the subdirectory

tree, from the parent directory. See NOTE 1.

[SUCCESS,MESSAGE,MESSAGEID] = RMDIR(DIRECTORY) removes DIRECTORY from

parent directory, returning status and error information as described

below under Return Parameters.

[SUCCESS,MESSAGE,MESSAGEID] = RMDIR(DIRECTORY,MODE) removes DIRECTORY from

the parent directory, subject to access rights. RMDIR can remove

subdirectories recursively.

INPUT PARAMETERS:

DIRECTORY: string specifying a directory, relative or absolute.

See NOTE 2.

MODE: character scalar indicating the mode of operation.

's': indicates that the subdirectory tree, implied by DIRECTORY,

will be removed recursively.

RETURN PARAMETERS:

SUCCESS: logical scalar, defining the outcome of RMDIR.

1 : RMDIR executed successfully.

0 : an error occurred.

MESSAGE: string, defining the error or warning message.

empty string : RMDIR executed successfully.

message : an error or warning message, as applicable.

MESSAGEID: string, defining the error or warning identifier.

empty string : RMDIR executed successfully.

message id: the MATLAB error or warning message identifier

(see ERROR, MException, WARNING, LASTWARN).

NOTE 1: MATLAB removes the subdirectory tree regardless of the write

attribute of any contained file or subdirectory.

NOTE 2: UNC paths are supported. RMDIR does not support the wildcard *.

See also cd, copyfile, delete, dir, fileattrib, mkdir, movefile.

Overloaded methods:

ftp/rmdir

Reference page in Help browser

doc rmdir

<getenv> - Get environment variable.

GETENV Get environment variable.

GETENV('NAME'), where NAME is a text string, searches the underlying

operating system's environment list for a string of the form

NAME=VALUE and returns the string VALUE if such a string is present.

Соседние файлы в папке Библиотеки Matlab