verifyFolder: FUSION R command line interface - Verify existence of a...

View source: R/CoreFunctions.R

verifyFolderR Documentation

FUSION R command line interface – Verify existence of a folder

Description

This is a helper function used in the fusionwrapr package to verify the existence of folder and create the folder(s) if it does not exist. verifyFolder is normally called with a folder extracted using dirname() when an output file is provided to a function. When saving commands to a file, a command will be written to create the folder in addition to creating the folder. This can make it easier to delete the results from a set of processing steps and then re-run them using the command file. When saving to a command file, there is checking to see if the folder already exists. This prevents multiple attempts to create the same folder and any associated error or warning messages. In addition, when saving to a command file, the path is enclosed in quotes to prevent problems when the folder names contain spaces.

Usage

verifyFolder(
  folder,
  runCmd = TRUE,
  saveCmd = TRUE,
  cmdFile = NULL,
  cmdClear = FALSE
)

Arguments

folder

folder name

runCmd

boolean: indicates command line should be executed. If TRUE, no commands will be written to the batch file regardless of the value for saveCmd.

saveCmd

boolean: indicates command line the create the folder(s) should be written to a file. This command will create the folder(s) when the command file is run from a command prompt.

cmdFile

character: contains the name of the file to which commands should be written.

cmdClear

boolean: indicates file for commands should be deleted (cleared) before the command line is written.

Value

An (invisible) boolean TRUE, If the folder does not exist and cannot be created, execution stops.

Examples

## Not run: 
verifyFolder("/test")

## End(Not run)

bmcgaughey1/fusionwrapr documentation built on Dec. 1, 2024, 7:13 a.m.