util_check_file_type: Check File Type

Description Usage Arguments Author(s) Examples

View source: R/util_check_file_type.R

Description

Checks if files have the specified file type. Returns filenames of files that mismatch the file type specified with an option to delete them.

Usage

1
2
3
4
5
6
7
8
util_check_file_type(
  dir = getwd(),
  fn,
  file_type = "PDF document",
  remove_files = FALSE,
  par = TRUE,
  ncores = NULL
)

Arguments

dir

Character string. Directory which contains target files.

fn

Character vector. Filenames.

file_type

Character string. File type. For example, "PDF document" for PDF and "EPUB document" for EPUB.

remove_files

Logical. Remove files that do not match the specified file type. BE CAREFUL WITH THIS OPTION AS FILES CAN BE DELETED FROM YOUR SYSTEM.

par

Logical. If TRUE, use multiple cores.

ncores

Integer. Number of cores to use if par = TRUE. If unspecified, defaults to detectCores() - 1.

Author(s)

Ivan Jacob Agaloos Pesigan

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
util_check_file_type(
  dir = getwd(),
  fn = c(
    "file_01.pdf",
    "file_02.pdf",
    "file_03.pdf",
    "file_04.pdf",
    "file_05.pdf"
  ),
  file_type = "PDF document",
  par = FALSE
)

## End(Not run)

jeksterslabds/jeksterslabRutils documentation built on Jan. 18, 2021, 11:41 p.m.