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

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

Ivan Jacob Agaloos Pesigan

Examples

if (FALSE) { 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 ) }