[R] file mode lost in file.copy()?
Yihui Xie
xie at yihui.name
Sun Mar 6 00:31:29 CET 2011
Hi,
Recently I noticed file.copy() would discard the file mode
information. Is this the expected behaviour or a bug for file.copy()?
> file.create('testfile')
[1] TRUE
> file.info('testfile')
size isdir mode mtime ctime
testfile 0 FALSE 644 2011-03-05 17:06:39 2011-03-05 17:06:39
atime uid gid uname grname
testfile 2011-03-05 17:06:40 1000 1000 yihui yihui
> Sys.chmod('testfile', '0755')
> file.info('testfile')
size isdir mode mtime ctime
testfile 0 FALSE 755 2011-03-05 17:06:39 2011-03-05 17:06:59
atime uid gid uname grname
testfile 2011-03-05 17:07:00 1000 1000 yihui yihui
> file.copy('testfile', 'testfile2')
[1] TRUE
> file.info('testfile2')
size isdir mode mtime ctime
testfile2 0 FALSE 644 2011-03-05 17:07:20 2011-03-05 17:07:20
atime uid gid uname grname
testfile2 2011-03-05 17:07:21 1000 1000 yihui yihui
> sessionInfo()
R version 2.12.2 (2011-02-25)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.utf8 LC_NUMERIC=C
[3] LC_TIME=en_US.utf8 LC_COLLATE=en_US.utf8
[5] LC_MONETARY=C LC_MESSAGES=en_US.utf8
[7] LC_PAPER=en_US.utf8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA
More information about the R-help
mailing list