Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

umx_rename_file

Rename files


Description

Rename files. On OS X, the function can access the current front-most Finder window. The file renaming is fast and, because you can use regular expressions too change names.

Usage

umx_rename_file(
  findStr = "old",
  replaceStr = NA,
  baseFolder = "Finder",
  test = TRUE,
  ignoreSuffix = TRUE,
  listPattern = NULL,
  overwrite = FALSE
)

Arguments

findStr

The pattern to find, i.e., "cats"

replaceStr

The replacement pattern "\1 are not dogs"

baseFolder

Folder to search in. Default ("Finder") will use the current front-most Finder window (on MacOS). Set to NA for a "choose folder" dialog.

test

Boolean determining whether to change files on disk, or just report on what would have happened (Defaults to test = TRUE)

ignoreSuffix

Whether to ignore (don't search in) the suffix (file-type like .mpg) TRUE.

listPattern

A pre-filter for files

overwrite

Boolean determining if an existing file will be overwritten (Defaults to the safe FALSE)

Value

None

See Also

Examples

## Not run: 
# "Season 01" --> "S01" in current folder in MacOS Finder
umx_rename_file("[Ss]eason +([0-9]+)", replaceStr="S\\1", test = TRUE)

# move date to end of file name
umx_rename_file("^(.*) *([0-9]{2}\\.[0-9]{2}\\.[0-9]+) *(.*)", replaceStr="\\1 \\3 \\2")


## End(Not run)

umx

Structural Equation Modeling and Twin Modeling in R

v4.10.10
GPL-3
Authors
Timothy C. Bates [aut, cre] (<https://orcid.org/0000-0002-1153-9007>), Gillespie Nathan [wit], Michael Zakharin [wit], Brenton Wiernik [ctb], Joshua N. Pritikin [ctb], Michael C. Neale [ctb], Hermine Maes [ctb]
Initial release
2021-11-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.