Files: Textual file system browser

View source: R/files.r

FilesR Documentation

Textual file system browser

Description

Textual file system browser

Usage

Files(root=getwd(), multiple=FALSE, hidden=FALSE)

Arguments

root

Root directory to explore, default is the working directory

multiple

Allows multiple files to be selected

hidden

Show hidden files?

Details

Interactive text-based file chooser dialog, modified from code published by "mathematical.coffee" on Stack Overflow as "R command-line file dialog".

If 'multiple=TRUE', one can select files one by one (they will "disappear" from the displayed list), and typing "0" will output this list. If "multiple=FALSE", typing "0" will output the name of the current directory.

Files() uses normalizePath() so symbolic links will be resolved. Also, Files() is not very useful when number of files in the directory is large.

Alternatives for Linux: 'tcltk::tk_choose.files()' and 'tcltk::tk_choose.dir()'

Value

Returns character vector of selected files, or directory name (useful for 'setwd()'), or new user-defined file name with full path.

Author(s)

Alexey Shipunov

See Also

setwd, getwd, dir

Examples

## Not run: 
## interactive commands
setwd <- Files() # then select directory to work in
Files("~", hidden=TRUE) # explore home directory with hidden files (Linux, macOS)

## End(Not run)

shipunov documentation built on Feb. 16, 2023, 9:05 p.m.

Related to Files in shipunov...