The R Project SVN R

Rev

Rev 74064 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
74064 ripley 1
% File src/library/base/man/Sys.setFileTime.Rd
68948 ripley 2
% Part of the R package, https://www.R-project.org
74543 kalibera 3
% Copyright 2011-2018 R Core Team
56167 ripley 4
% Distributed under GPL 2 or later
5
 
6
\name{Sys.setFileTime}
56186 murdoch 7
\alias{Sys.setFileTime}
56167 ripley 8
\title{
9
  Set File Time
10
}
11
\description{
12
  Uses system calls to set the times on a file or directory.
13
}
14
\usage{
15
Sys.setFileTime(path, time)
16
}
17
 
18
\arguments{
19
  \item{path}{
74543 kalibera 20
    A character vector containing file or directory paths.
56167 ripley 21
  }
22
  \item{time}{
74543 kalibera 23
    A date-time of class \code{"\link{POSIXct}"} or an object which can be
24
    coerced to one.  Fractions of a second may be ignored.  Recycled along
25
    \code{paths}.
56167 ripley 26
  }
27
}
28
\details{
29
  This attempts sets the file time to the value specified.
61433 ripley 30
 
71395 ripley 31
  On a Unix-alike it uses the system call \code{utimensat} if that is
32
  available, otherwise \code{utimes} or \code{utime}.  On a POSIX file
33
  system it sets both the last-access and modification times.
34
  Fractional seconds will set as from \R 3.4.0 on OSes with the
35
  requisite system calls and suitable filesystems.
61433 ripley 36
 
56167 ripley 37
  On Windows it uses the system call \code{SetFileTime} to set the
38
  \sQuote{last write time}.  Some Windows file systems only record the
39
  time at a resolution of two seconds.
74543 kalibera 40
 
41
  \code{Sys.setFileTime} has been vectorized in \R 3.6.0.  Earlier versions
42
  of \R required \code{path} and \code{time} to be vectors of length one.
56167 ripley 43
}
44
\value{
74543 kalibera 45
  A logical vector indicating if the operation succeeded for each of the
46
  files and directories attempted, returned invisibly.
56167 ripley 47
}
48
\keyword{file}
49