I am Using Pyhton paramiko and My website server has folder structure like this-
1]dir1
--dirP
--dirQ
2]dir2
--dirA
--file.sh
Or if you use variables need to add + for example
client.exec_command('str(var1)+str(var2))
client.exec_command("cmd ...")
is just like the command ssh user@host "cmd ..."
so
client.exec_command('cd dir2')
client.exec_command('ls')
are just like
ssh user@host 'cd dir2' # this would not affect the following `ls'
ssh user@host 'ls'
. So you need to do like this:
client.exec_command('cd dir2; ls')
which is just like
ssh user@host 'cd dir2; ls'