title: Redirect output No such file or directory
body: <p>I am trying to launch a script to echo (as a test) the file name of files in a different directory but get the "No such file or directory" error. It looks like it is appending the whole directory of where I'm echoing from to the file name I'm trying to redirect to but how do I fix that. Thank you.</p>
  
  <pre><code>for filename in /data/logs/2017/jan/201701*
  do
  echo $filename &gt; /home/bishopm/${filename%.gz}
  done
  </code></pre>
  
  <p>Getting the following errors for each file trying to echo:</p>
  
  <pre><code>./data_collector.sh: line 5: /home/bishopm//data/logs/2017/jan/20170131: No such file or directory
  </code></pre>