moveFilesUniquely: Move files to a single folder, renaming new files in cases of...

View source: R/moveFilesUniquely.R

moveFilesUniquelyR Documentation

Move files to a single folder, renaming new files in cases of conflict.

Description

Move files to a single folder, renaming new files in cases of conflict.

Usage

moveFilesUniquely(src, dst, copyLinkTargets = FALSE)

Arguments

src

character vector of full paths of files to move

dst

path to target folder

copyLinkTargets

logical: if TRUE, when an item in 'src' is a symbolic link, it is replaced with a copy of the target of the link, and it is that copy which is moved to 'dst', rather than just the symlink itself. Default: FALSE (it is the symlink itself which is moved, not the file it points to).

Details

Filenames that conflict with each other or those already in dst are changed like so:

  1. if the filename does not end in -NNN where NNN is an integer, then add -1 to the filename; e.g.

    myfile.txt -> myfile.txt-1

  2. if the filename already ends in -NNN, then increment NNN; e.g.

    myfile.txt-3 -> myfile.txt-4

Value

a character vector of the same length as src, with non-NA entries giving new names for any files that were renamed

Author(s)

John Brzustowski jbrzusto@REMOVE_THIS_PART_fastmail.fm


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