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

martin

Re: possible to get just the last line of an ls?

See this example script for similar task.
larsonp

possible to get just the last line of an ls?

A server I connect to seems to be blocking my ability to run arbitrary commands via scp. I can only run commands that winscp has built in.

Is it possible to run an ls on the current directory, but only return the last line?

What I used to do was to call a remote command that copied the file to a standard place, and then run a command to download it.
here's the idea.
call cp -p `ls /path/to/file/namewithdate*.TXT|tail -1` /other/path/ID_namewithdate.txt

get -preservetime /other/path/ID_namewithdate.txt c:\NewFilename.txt


But, since I can't run "CALL" anymore, I'm sorta stuck.
I can still "ls," but I can't get winscp to parse the returned stuff to get last line of the directory listing.
Any ideas OTHER than work with the owners of the server?