possible to get just the last line of an ls?

Advertisement

larsonp
Joined:
Posts:
3

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?

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum