Matthew Felgate
Matthew Felgate

Reputation: 166

How do I escape a forward slash in a filename in rsync?

I am running a command like:

rsync -vuan "/Volumes/Working/foldername/" "/Volumes/Archive/foldername/"

It doesn't work when folder names have a '/' like "12/13 The Street"

How do I escape the forwardslash?

Upvotes: 2

Views: 2591

Answers (2)

john
john

Reputation: 51

It is really simple: unix doesn't allow / but Mac fakes it. The GUI uses a slash but the unix uses a colon :

Just open up the terminal and ls the directory and it'll show you colons instead of slashes. Classic mac forbid colons in names because that was the path delimiter; Applescript still works this way and probably Carbon APIs as well. The modern Finder forbids the user from using : but it does the translation of slashes to colons.

Upvotes: 5

Mayank Agarwal
Mayank Agarwal

Reputation: 895

Linux does not support to have / in the filenames. By default if u need to escape a particular string we use

\Character_to_be_escaped

Even windows does not allow the use of / in the filename. To my knowledge, having a file or folder with name / is not possible.

You can check i tried to create a folder

mkdir 1/2
mkdir: cannot create directory `1/2': No such file or directory

Creating folder by escaping

mkdir 1\/2
mkdir: cannot create directory `1/2': No such file or directory

Upvotes: 0

Related Questions