title: why does this tar command fail when passed as string in ssh call?
body: <pre><code>ssh user@server &quot;sudo tar -czf - -C /path/To/Directory *.properties&quot; | tar xzf -
  </code></pre>
  <p>It fails with following error -</p>
  <blockquote>
  <p>tar: *.properties: Cannot stat: No such file or directory</p>
  <p>tar: Exiting with failure status due to previous errors</p>
  </blockquote>
  <p>If I ssh to server and then on server, instead of <code>tar -czf -</code> use <code>tar -czf abc.tgz</code> and remove the piped command at the end, it works correctly i.e. compress all the .properties file from the directory?</p>
  <p>I have tried using --wildcards parameter as well as -P and the complete path ending with *.properties, but they didn't work either.</p>