How to get the last file created on Linux using pscp PuTTY?

08
2014-07
  • Zasil Medina

    I'm accesing an Ubuntu system using pcsp from PuTTY on a Windows PC. I need to retrive the last file created on a folder.

    For now i only have a script that retrieves all the files on a folder:

    set PATH=C:\Program Files (x86)\PuTTY;%PATH%
    pscp
    pscp [email protected]:unit_logs/* C:\Users\Zasil-Ha\Documents
    

    How so I do to get the last file created on unit_logs folder???

    Thank you in advance!

  • Answers
  • Jakke

    What you should do is to make a script the other way around. Push the latest file from Linux to Windows. To do this:

    scp `ls -c|head -n1` user@windows_machine:<path>
    

  • Related Question

    linux - How to avoid "Connection Refused" error while using PuTTY?
  • joe

    I just installed Linux on my computer and tried connecting to it using PuTTY. The problem is that I keep getting "Connection Refused". Is there a simple fix, or is it something bigger?


  • Related Answers
  • i-g

    You're getting this error because sshd (the SSH server/daemon) is not running on that computer.

    How to start it depends on what distribution you're using on that computer. Please update your question to include that information.

    You can also search the Web for "<distribution name> start sshd" and see what comes up.

    Oh, and before all this, make sure that you are trying to connect to the correct IP address. You can find out what IP address the computer has at the moment by running "ifconfig -a" at the command prompt. You may have to run the command using sudo, like this: "sudo ifconfig -a".