title: python script to connect to remote server and count the number of files
body: <p>I have a requirement to get the number of files in the remote server thru Python.I have used the paramiko module and wrote the below script. The linux command when running in the terminal is giving me the desired output whereas when executing from Python is giving me the output as [u'0\n'].Any help is highly appreciated.</p>
  
  <pre><code>#!/usr/local/bin/python
  import paramiko
  client=paramiko.SSHClient()
  client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  client.connect('hostname', username='username')
  grepCommand="ssh  username@hostname 'find /usr/local/somefolder1/somefolder2 -type f   -exec ls  {} \;'|wc -l"
  stdin,stdout,stderr = client.exec_command(grepCommand)
  data=stdout.readlines()
  print data
  client.close()
  </code></pre>