utils_file | R Documentation |
file_extension()
Get the extension of a file.
file_name()
Get the name of a file.
file_dir()
Get or directory of a file
manipulate_files()
Manipulate files in a directory with options to rename
(insert prefix or suffix) and save the new files to the same or other provided
directory.
pliman_indexes()
Get the indexes available in pliman.
pliman_indexes_eq()
Get the equation of the indexes available
in pliman.
file_extension(file)
file_name(file)
file_dir(file)
manipulate_files(
pattern,
dir = NULL,
prefix = NULL,
name = NULL,
suffix = NULL,
extension = NULL,
sep = "",
save_to = NULL,
overwrite = FALSE,
remove_original = FALSE,
verbose = TRUE
)
pliman_indexes()
pliman_indexes_eq()
file |
The file name. |
pattern |
A file name pattern. |
dir |
The working directory containing the files to be manipulated. Defaults to the current working directory. |
prefix, suffix |
A prefix or suffix to be added in the new file names.
Defaults to |
name |
The name of the new files. Defaults to |
extension |
The new extension of the file. If not declared (default), the original extensions will be used. |
sep |
An optional separator. Defaults to |
save_to |
The directory to save the new files. Defaults to the current
working directory. If the file name of a file is not changed, nothing will
occur. If |
overwrite |
Overwrite the files? Defaults to |
remove_original |
Remove original files after manipulation? defaults to
|
verbose |
If |
file_extension()
, file_name()
, and file_dir()
return a character
string.
manipulate_files()
No return value. If verbose == TRUE
, a message is
printed indicating which operation succeeded (or not) for each of the files
attempted.
library(pliman)
# get file name, directory and extension
file <- "E:/my_folder/my_subfolder/image1.png"
file_dir(file)
file_name(file)
file_extension(file)
# manipulate files
dir <- tempdir()
list.files(dir)
file.create(paste0(dir, "/test.txt"))
list.files(dir)
manipulate_files("test",
dir = paste0(dir, "\\"),
prefix = "chang_",
save_to = paste0(dir, "\\"),
overwrite = TRUE)
list.files(dir)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.