title: How to get specific files with lftp batch file
body: <p>I'm actually trying to get all files beginning with the current date from another server with SFTP. Nevertheless, <code>*</code> does not work in SFTP so I don't see how I can do...</p>
  
  <p>Here is the batch I've done so far:</p>
  
  <pre><code>#!/bin/sh
  today=$(date +%Y%m%d)
  lftp&lt;&lt;END_SCRIPT
  open sftp://name@server
  get $today*
  bye
  END_SCRIPT
  </code></pre>
  
  <p>@Martin Prikryl</p>
  
  <p>Thank you, it works fine now.
  I've search a bit before you answered and I've found this (a lot less efficient^^):</p>
  
  <pre><code>today=$(date +%Y%m%d)
  var=`echo `echo ls -1 | sftp name@domain:dir1/subdir` | sed -n 's/ /\n/gp'|sed -n '/^$today/p'`
  lftp&lt;&lt;END_SCRIPT
  open sftp://name@server
  get $var
  bye
  END_SCRIPT
  </code></pre>