Skip to contents

Open files, folders, or URLs through the operating system default application.

Usage

sys_open(..., .quiet = TRUE)

Arguments

...

path strings to the files or folder you want to open

  • inputs can be any combination of lists, vectors, or comma-separated inputs

  • no input opens the current working folder location

  • paths are automatically expanded using normalizePath()

.quiet

if TRUE, will echo unix system errors and warnings to the console

Value

character vector of named paths

Details

If you aren't able to open a file with sys_open(), right-click on the file to make sure your operating system has a default application assigned to that file type, and that double-clicking the file opens it in that default application.

Examples

if (FALSE) {
# open current working directory
sys_open('.')
sys_open(here::here())
sys_open()

# open parent of current working directory
sys_open('..')

# open user home dir
sys_open('~')

# open system dir
sys_open('/')

# open the first 3 files or folders in the current directory
list.files(here::here())[1:3] |> sys_open()

# open the current temp directory
sys_open(tempdir())

# also opens a browser if sent a path that begins with 'https://'
# or 'http://' (or contains '.com/','.org/', etc. or ends in them but without forward slash)
sys_open('google.org')

# last value can be empty, which will open the working directory
sys_open('google.org', )

}