title: execute ftp with white space in path
body: <p>The following PowerShell script runs an ftp command but returns an error as it cannot get find the absolute source path (which includes white space and does take the complete path as "File One” and “Destination One". </p>
  
  <p>Output:</p>
  
  <pre><code>/usr/bin/lftp -c \"mirror --only-missing --verbose sftp://jason@10.1.1.1:/e:/Files/File One e:/Files/Destination One/File One\"
  
  Access failed: No such file (e:/Files/File)
  </code></pre>
  
  <p>The values of each variables are hardcoded and cannot be changed for a reason. In that case, what are the changes required in the $ftppath or $ftpcmd to include these white spaces in the source and dest, so it can return the ftpcmd correctly. Could someone please help?</p>
  
  <p>Script:</p>
  
  <pre><code># these values are hardcoded and cannot be modified
  
  $root = "/e:/Files"
  $source = "File One"
  $dest = "e:/Files/Destination One/File One"
  $user = "jason"
  $server = "10.1.1.1"
  
  # ftp command
  $ftppath = "sftp://$user" + '@' + $server + ':' + $root + '/'  + $source + ' ' + $dest
  $ftpcmd = '/usr/bin/lftp -c \"mirror --only-missing  --verbose ' + "$ftppath"+'\"'
  $ftpcmd
  Invoke-Expression -command $ftpcmd
  </code></pre>