saveOldFile {blackbox}R Documentation

Save a copy of an existing file.

Description

This checks if a file of given name already exists in the current directory, and if so saves a copy of it under an automatically generated name (see below).

Usage

saveOldFile(filename)

Arguments

filename

Name of file to be saved.

Details

This function copies the file named “first names.ext” under a name created by inserting a string of the form .old_n between “first names” and “.ext”, where n is one more than the highest value for any file, matching the first names and extension, already in the current directory, and 0 if no file matches. For example, if filename is my.beautiful.pdf, it is copied as my.beautiful.old_0.pdf if no my.beautiful.old_n.pdf file exists, and is is copied as my.beautiful.old_4.pdf if my.beautiful.old_3.pdf (and any lower n) file exists.

Value

Returns "" if no file with given name was present on disk, FALSE if it failed to copy an existing old file, and the name of the copy if it successfully copied such a file.

Examples

## Not run: 
saveOldFile("same.story")

## End(Not run)

[Package blackbox version 1.1.46 Index]