Post a reply

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

Guest

Re: Sorting a remote directory

Many thanks
martin

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:
https://winscp.net/eng/docs/script_custom_listing_format_csv

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

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