Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

sunn

sunn wrote:

I am trying to do the same thing but problem is I need to have during the week 1 file and oon the weekend I need 3 files.

I need to have them by timestamp so easier to get by date. What would the code look like.


Also I am using
C:\Program Files\WinSCP\WinSCP.com Logininfo /script=C:\Downloads\myscript.txt

I would like to add more to the script or make a new script similar to what i am using ( basic get statement ). That file on the ftp are .gz and need to converted in excel or csv format.
sunn

I am trying to do the same thing but problem is I need to have during the week 1 file and oon the weekend I need 3 files.

I need to have them by timestamp so easier to get by date. What would the code look like.
LeonPix

thx! it's an inspiring answer :)
martin

Re: How to get latest modified file?

I do not see any nice solution. One of the ugly ways that come to my mind is:
# make copy of the latest file with unique extension,

# so that it can be grabbed by file mask
# (note that you can make the copy in /tmp if needed)
call cp `ls -t | head -1` `ls -t | head -1`.latest
# download the copy, but strip the extension
get *.latest *.
# remove the copy
rm *.latest
LeonPix

Re: How to get latest modified file?

Let's say after we connect to a remote sftp site. By doing "ll" we got this:

31/07/2006 20:16 2,417,200 file_a
31/07/2006 22:16 2,484,770 file_b
31/07/2006 24:16 2,484,770 file_c

Timestamp of file_c has the latest timestamp.

How can we write a script to download file_c which has the latest timestamp in this directory?

Do I make myself clear in this case? Thanks!
martin

Re: How to get latest modified file?

I do not understand what you ask for. Please try again :-)
LeonPix

How to get latest modified file?

Hi,

How to get lastest modified timestamped file in remote folder using script?

Meaning, after "cd remote_folder", I wanna "get file", which this file has latest modification timestamp at remote directory.

Thank you!