rename_with_nums: Replace file names with numbers

Description Usage Arguments Value Examples

Description

Rename the files in the directory, replacing file names with numbers only.

Usage

1

Arguments

dir

The directory in which to rename the files (relative or absolute path). Defaults to current working directory.

pattern

A regular expression. If specified, only files with names matching this pattern will be treated.

Value

A logical vector with a TRUE for each successful renaming and a FALSE otherwise.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
dir.create("RenameWithNums_test")
setwd("RenameWithNums_test")
files <- c("1litres 1.txt", "1litres 30.txt", "3litres 5.txt")
file.create(files)
rename_with_nums()
list.files()
setwd("..")
dir.remove("RenameWithNums_test")

## End(Not run)

Example output

Loading required package: stringr
[1] TRUE TRUE TRUE
[1] TRUE TRUE TRUE
[1] "1.txt" "2.txt" "3.txt"
1 directory deleted. 0 failed to delete.

filesstrings documentation built on April 18, 2021, 9:12 a.m.