getting info on remote files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gabriel.altay@gmail.com

    #1

    getting info on remote files

    hello everyone,

    Im trying to write some python code that will return information (file
    size, last modified ...) about files on a remote computer that I have
    'no password' ssh access to. Ive been able to write code that logs on
    to remote computers and I can issue a command using,

    os.system(ssh blah.blah.blah. org "ls -l myfile")

    but how do I store the information returned by the ls command into a
    variable. The primary goal of this is to
    1. check file size on remote computer
    2. scp file to local computer
    3. make sure file size of copy and original are the same

    any suggestions would be appreciated

    thanks
    gabe

  • Larry Bates

    #2
    Re: getting info on remote files

    gabriel.altay@g mail.com wrote:
    hello everyone,
    >
    Im trying to write some python code that will return information (file
    size, last modified ...) about files on a remote computer that I have
    'no password' ssh access to. Ive been able to write code that logs on
    to remote computers and I can issue a command using,
    >
    os.system(ssh blah.blah.blah. org "ls -l myfile")
    >
    but how do I store the information returned by the ls command into a
    variable. The primary goal of this is to
    1. check file size on remote computer
    2. scp file to local computer
    3. make sure file size of copy and original are the same
    >
    any suggestions would be appreciated
    >
    thanks
    gabe
    >
    Why not just use rsync across the ssh tunnel to synchronize the remote
    file to local file? This works great and you don't have to do much.

    -Larry

    Comment

    Working...