Skip to content

Instantly share code, notes, and snippets.

@kanazux
Last active July 10, 2017 20:03
Show Gist options
  • Save kanazux/5af397157f89ab81cc5f69c096d6158d to your computer and use it in GitHub Desktop.
Save kanazux/5af397157f89ab81cc5f69c096d6158d to your computer and use it in GitHub Desktop.
nanga problems
kanazuchi@sbuilder:~/nanga % ./nanga_server1.py
Arquivos a serem copiados: 3 1 5 2
3 100% 0 0.0KB/s 00:00
1 100% 0 0.0KB/s 00:00
5 100% 0 0.0KB/s 00:00
2 100% 0 0.0KB/s 00:00
#!/usr/local/bin/python2.7
import os
from subprocess import check_output
dir1 = os.listdir('/home/kanazuchi/nanga/dir1')
dir2 = filter(None, check_output(["ssh [email protected] -C 'python2.7 nanga/nanga_server2.py'"], shell=True))
dir_diff = filter(None, [x for x in dir2 if x not in dir1 if x != '\n'])
print "Arquivos a serem copiados: {}".format(" ".join(dir_diff))
for x in dir_diff:
os.system('scp [email protected]:/home/freebsd/nanga/dir1/{} dir1/'.format(x))
#!/usr/local/bin/python2.7
import os
from subprocess import check_output
dir1 = os.listdir('/home/freebsd/nanga/dir1')
print " ".join(dir1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment