2

So i got two (supposed) to be equal very big folders on two machines. I want to compare their file sizes for each file in the folder. Every once in a while files that should be equal are not, and one of the files is smaller then it should be.

The compare is easy and widely explained on the net, but how is the shh connectivity done ? that is my Q. What is the best practice ? Thanks

2

1 Answer 1

1

This is not a real compare but anyway:

import subprocess
f_pass ='pswd'
f_ip = '10.10.10.10'
f_user = 'root'
f_folder = '/tmp/'
s_pass ='pswd'
s_ip = '10.10.10.11'
s_user = 'root'
s_folder = '/tmp/'

f_cmd = "sshpass -p '{}' ssh {}@{} find  {} -ls".format(f_pass, f_user, f_ip, f_cmp_folder)
s_cmd = "sshpass -p '{}' ssh {}@{} find  {} -ls".format(s_pass, s_user, s_ip, s_cmp_folder)

f_result = subprocess.check_output(f_cmd, shell=True)
s_result = subprocess.check_output(s_cmd, shell=True)

Now you can do what u want with the output of the find command, you may also compare them ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.