safeFileRename: rename files, even across filesystems

View source: R/safeFileRename.R

safeFileRenameR Documentation

rename files, even across filesystems

Description

drop-in replacement for file.rename that correctly handles renames across filesystems on linux - copies the file from filesystem A to filesystem B - only if the copy succeeded, delete the file from filesystem B

Usage

safeFileRename(from, to)

Arguments

from

character vector giving filename or path

to

character vector giving filename or path

Value

logical vector,rv, that is TRUE for each successful rename, FALSE elsewhere

Upon returning:

  • the files 'from[rv]' no longer exist, and their contents are now stored in files 'to[rv]'.

  • the files 'from[! rv]' and 'to[! rv]' are preserved, if they already existed, and are not created if they didn't already exist.

i.e. unsuccesful renaming leaves source and destination items as they were.

Author(s)

John Brzustowski jbrzusto@REMOVE_THIS_PART_fastmail.fm


MotusWTS/motusServer documentation built on Oct. 13, 2024, 7:31 p.m.