Please read the comments in the help about umask (and in the posting guide about the 'at a minimum' information required in postings, for the details do depend on the version of R and it seems yours is not current).

In R 2.13.0:

     ‘dir.create’ creates the last element of the path, unless
     ‘recursive = TRUE’.  Trailing path separators are discarded.  The
     mode will be modified by the ‘umask’ setting in the same way as
     for the system function ‘mkdir’.

so try

um <- Sys.umask(0)
dir.create('test/sub', recursive=TRUE)
Sys.umask(um)

(Whether mkdir -p respects umask depends on your OS ... and the command-line command and the system call of that name may differ.)

On Wed, 4 May 2011, Xian Zhang wrote:

Dear list,

I am trying to create a folder structure, say 'test/sub', and set the
folder and sub folder to be writable to everyone.

By default

dir.create('test/sub', recursive=TRUE, mode='0777')

creates folders with mode: drwxr-xr-x

After

Sys.chmod('test/sub',mode='0777')

The folder 'test' is: drwxr-xr-x
and the sub folder 'sub' is: drwxrwxrwx

The question is how to generate a folder and sub folders, with every
folder being drwxrwxrwx ?

I am using a linux/redhat system.

Thank you for your help.
Xian

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


--
Brian D. Ripley,                  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to