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 [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!

  • 1
    I doubt you can. You might have to look for an alternative, like having a script on the linux box update a symlink to point at the latest file. Then you can simply use the symlink to copy the latest file.
    – Zoredache
    Jun 23, 2014 at 23:49

1 Answer 1


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>
  • and yes, you may have to install ssh-server on your Windows computer :)
    – Jakke
    Jun 24, 2014 at 1:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .