[英]How to change the status of the directory file in tcl?
The thing is, I was assigned to do a tcl script that can change the status of the directory file. 事情是,我被分配去做一个tcl脚本,可以更改目录文件的状态。 I used the
file stat *name* array
command to display the inodes, like this: 我使用了
file stat *name* array
命令来显示索引节点,如下所示:
file stat $f arr
if { $g eq "size" } {
puts "size: $arr(size)"
}
if { $g eq "inode" } {
puts "inode: $arr(ino)"
}
if { $g eq "type" } {
puts "type: $arr(type)"
}
... ...
What should I use to change it? 我应该用什么来改变它? All I can do for now is to access and display it.
我现在所能做的就是访问并显示它。
Not everything in the OS stat
structure (which file stat
really wraps) is modifiable by user code. 并非用户
file stat
可以修改OS stat
结构中的所有内容( file stat
真正包装的内容)。 Some things are managed by the OS entirely, and are set at the time of the creation of the “file” and cannot be altered later. 有些东西完全由OS管理,并且在创建“文件”时进行设置,以后不能更改。 For example, you can't change the
type
: a file
isn't a directory
or a socket
or … and the device and inode number are effectively a unique identifier for the file independent of its name and never change. 例如,您不能更改
type
: file
不是directory
, socket
或…,而设备和索引节点号实际上是文件的唯一标识符,而与文件名无关,并且永不更改。
The atime
and mtime
fields can be set (via file atime
and file mtime
) and the permissions bits via file attributes
. 可以通过
file attributes
设置atime
和mtime
字段(通过file atime
file mtime
和file mtime
)和权限位。 The ownership fields are theoretically settable (also via file attributes
) but you probably haven't got permission to do so, and the link
count is sort-of settable by creating hard links (with file link
) or deleting them ( file delete
). 所有权字段在理论上是可以设置的(也可以通过
file attributes
),但是您可能没有权限这样做,并且可以通过创建硬链接(带有file link
)或删除它们( file delete
)来对link
数进行设置。
The size
just reflects how many bytes are in the file: don't think of setting it so much as writing to the file. size
仅反映文件中有多少字节:不要像写文件一样考虑设置太多。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.