Post a reply

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)


Topic review


Re: Sorting a remote directory

Many thanks

Re: Sorting a remote directory

You better use WinSCP .NET assembly (e.g. from PowerShell) if you want to customize the output anyhow.
For an example, see:

For sort the file for example by time, use:
$directory = $session.ListDirectory($remotePath)
$files = $directory.Files | Sort-Object LastWriteTime -Descending
foreach ($fileInfo in $files)

Sorting a remote directory

Is there a way to sort a remote directory, using a script command, so that the ls command will return the listing in the order you want? Thank you