Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

renameFile

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

## Default S3 method:
renameFile(pathname, newPathname, overwrite=FALSE, ..., verbose=FALSE)

Arguments

pathname

The pathname of the file to be renamed.

newPathname

The new pathname. If an existing directory and the source is a file, then the destination becomes file.path(newPathname, basename(pathname)).

overwrite

If TRUE and there exists a file with new pathname, then it is overwritten.

...

Not used.

verbose

See Verbose.

Value

Returns TRUE if the file was successfully renamed. If it failed, an exception is thrown.

Author(s)

Henrik Bengtsson

See Also


R.utils

Various Programming Utilities

v2.10.1
LGPL (>= 2.1)
Authors
Henrik Bengtsson [aut, cre, cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.