File: renameFile.Rd

package info (click to toggle)
r-cran-r.utils 2.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,864 kB
  • sloc: sh: 18; makefile: 6
file content (49 lines) | stat: -rw-r--r-- 1,437 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Do not modify this file since it was automatically generated from:
% 
%  renameFile.R
% 
% by the Rdoc compiler part of the R.oo package.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\name{renameFile}
\alias{renameFile.default}
\alias{renameFile}

\title{Renames a file (or a directory) atomically/safely}

\description{
 Renames a file (or a directory) atomically/safely,
 by also asserting that it was successfully renamed without side effects.
 If failing to rename and overwrite an existing file, the original file
 is kept.
}

\usage{
\method{renameFile}{default}(pathname, newPathname, overwrite=FALSE, ..., verbose=FALSE)
}

\arguments{
  \item{pathname}{The pathname of the file to be renamed.}
  \item{newPathname}{The new pathname.
   If an \emph{existing directory} and the source is a file, then the
   destination becomes \code{file.path(newPathname, basename(pathname))}.}
  \item{overwrite}{If \code{\link[base:logical]{TRUE}} and there exists a file with new pathname,
   then it is overwritten.}
  \item{...}{Not used.}
  \item{verbose}{See \code{\link[R.utils]{Verbose}}.}
}

\value{
  Returns \code{\link[base:logical]{TRUE}} if the file was successfully renamed.
  If it failed, an exception is thrown.
}

\author{Henrik Bengtsson}

\seealso{
  \code{\link[base:files]{file.rename}()}.
}


\keyword{internal}