I have the following python script which is trying to get file count in every sub-directory under the given path , but it gives no output :
#!/usr/bin/env python3.5
import subprocess
import os
command=r'ssh <some-server> "(echo \"import os\" ; echo \"for r,d,f in os.walk(\"/home/vibhora/\"): print (r,len(f))\")| python"'
ssh = subprocess.Popen(["bash", "-c", "{0}".format("command")], stdout=subprocess.PIPE)
out = ssh.stdout.read().decode('utf-8')
print(out)
Anybody has any idea what Am I doing wrong here ? Any better approach to get the file list are most welcome , Thanks in advance.