Midhun Mathew Sunny
Midhun Mathew Sunny

Reputation: 1361

Tar folder with backslash in the name

I am trying to archive a directory which has several backslashes in the name. My directory name is "\\abc\pqr\xyz". Here is the command I used.

tar -czf abc.tar "\\\\abc\\pqr\\xyz"

I was getting this error.

tar: \\abc\pqr\\xyz: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors

Upvotes: 0

Views: 600

Answers (1)

wildplasser
wildplasser

Reputation: 44250

Use single quotes. You can test with echo:

#!/bin/sh
echo "\\\\abc\\pqr\\xyz"
echo '\\\\abc\\pqr\\xyz'

Upvotes: 1

Related Questions