title: Shell: rsync parsing spaces incorrectly in file name/path
body: <p>I'm trying to pull a list of files over ssh with rsync, but I can't get it to work with filenames that have spaces on it! One example file is this:</p>
  
  <pre><code>/home/pi/Transmission_Downloads/FUNDAMENTOS_JAVA_E_ORIENTAÇÃO_A_OBJETOS/2. Fundamentos da linguagem/estruturas-de-controle-if-else-if-e-else-v1.mp4
  </code></pre>
  
  <p>and I'm trying to transfer it using this shell code.</p>
  
  <pre><code>cat $file_name | while read LINE
  do
      echo $LINE
      rsync -aP "$user@$server:$LINE" $local_folder
  done
  </code></pre>
  
  <p>and the error I'm getting is this:</p>
  
  <pre><code>receiving incremental file list
  rsync: link_stat "/home/pi/Transmission_Downloads/FUNDAMENTOS_JAVA_E_ORIENTAÇÃO_A_OBJETOS/2." failed: No such file or directory (2)
  rsync: link_stat "/home/pi/Fundamentos" failed: No such file or directory (2)
  rsync: link_stat "/home/pi/da" failed: No such file or directory (2)
  rsync: change_dir "/home/pi//linguagem" failed: No such file or directory (2)
  rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1655) [Receiver=3.1.0]
  </code></pre>
  
  <p>I don't get it why does it print OK on the screen, but parses the file name/path incorrectly! I know spaces are actually backslash with spaces, but don't know how to solve this. Sed (find/replace) didn't help either, and I also tried this code without success</p>
  
  <pre><code>while IFS='' read -r line || [[ -n "$line" ]]; do
      echo "Text read from file: $line"
      rsync -aP "$user@$server:$line" $local_folder
  done &lt; $file_name
  </code></pre>
  
  <p>What should I do to fix this, and why this is happening?</p>
  
  <p>I read the list of files from a .txt file (each file and path on one line), and I'm using ubuntu 14.04. Thanks!</p>