Utils: Functions for directory operations

Description Usage Arguments Value Examples

Description

Functions for directory operations

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
getBasenamePrefix(filepath, words, ...)

getPathPrefix(filepath, words, ...)

checkFileExist(filePath, ...)

checkPathExist(filePath, ...)

checkFileCreatable(filePath, ...)

addFileSuffix(filePath, suffix, ...)

Arguments

filepath

character scalar or vector.

words

character scalar. Remove substring of the path characters starting to match the word

...

Additional arguments, currently unused

filePath

Character scalar.

suffix

Character scalar. File suffix.

Value

getBasenamePrefix

Get the filepath basename with removed suffix

getPathPrefix

Get the filepath with removed suffix

checkFileExist

(For package developer) Check file is exist.

checkPathExist

(For package developer) Check directory is exist.

checkFileCreatable

(For package developer) Check file creatable.

addFileSuffix

(For package developer) Check if file suffix existed and add suffix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
getBasenamePrefix("aaa/bbb.ccc.ddd","cCc")

getBasenamePrefix("aaa/bbb.ccc.ddd","ddd")

getPathPrefix("aaa/bbb.ccc.ddd","dDd")

getPathPrefix("aaa/bbb.ccc.ddd","ccc")

file.create("test.bed")

checkFileExist("test.bed")

tryCatch({checkFileExist("test.bed1")},error = function(e) e)

dir.create("testdir")

checkPathExist(file.path(getwd(),"testdir"))

tryCatch({checkPathExist(file.path(dirname(getwd()),
"notexistfolder","testdir"))},error = function(e) e)

checkFileCreatable("aaa.bed")

tryCatch({checkFileCreatable("testdir1/aaa.bed")},error = function(e) e)

pipeFrame documentation built on Nov. 8, 2020, 5:51 p.m.