Learn R Programming

cooltools (version 2.4)

linuxspaces: Handle spaces in Linux filenames

Description

Convert spaces in filenames (" ") to linux-type spaces "\ ", needed when calling system() on macOS.

Usage

linuxspaces(txt)

Value

filename with modified spaces, e.g. "my\ file\ 1.txt"

Arguments

txt

filename, which may contain ordinary spaces, e.g. "my file 1.txt"

Author

Danail Obreschkow

Examples

Run this code
filename = '~/Desktop/my file 1.txt'
command = sprintf('ls -l %s',linuxspaces(filename))
if (FALSE) {
system(command)
}

Run the code above in your browser using DataLab