Im trying to assign -rxrxr-x to a file say file.txt using erlang shell. But we need to define a record before assigning to it. And all this i wanted to do in erlang shell.
1
votes
1 Answers
2
votes
You can use rr(Module)
in the shell to load the record definitions from the given module. See the shell documentation for details.
For example:
1> rr(file).
[file_descriptor,file_info]
2> {ok, Info} = file:read_file_info("hello.erl").
{ok,#file_info{size = 0,type = regular,access = read_write,
atime = {{2016,11,4},{14,8,35}},
mtime = {{2016,11,4},{14,8,35}},
ctime = {{2016,11,4},{14,8,35}},
mode = 33188,links = 1,major_device = 64512,
minor_device = 0,inode = 5769215,uid = 1000,gid = 1000}}
3> Info2 = Info#file_info{ mode = 8#00600 }.
#file_info{size = 0,type = regular,access = read_write,
atime = {{2016,11,4},{14,8,35}},
mtime = {{2016,11,4},{14,8,35}},
ctime = {{2016,11,4},{14,8,35}},
mode = 384,links = 1,major_device = 64512,minor_device = 0,
inode = 5769215,uid = 1000,gid = 1000}
4> ok = file:write_file_info("hello.erl", Info2).