ls command

Lists the contents of specified remote directory.

Advertisement (追記) (追記ここまで)

Syntax

ls [ <directory> ]/[ <wildcard> ]

Remarks

Lists the contents of specified remote directory. If directory is not specified, lists working directory. When wildcard 1 is specified, it is treated as set of files to list. Otherwise, all files are listed.

Alias: dir

Effective options: failonnomatch

XML log element: ls

Examples

ls *.html
ls /home/martin
ls 

Advertisement (追記) (追記ここまで)

ls /home/martin/*.html

Converting to .NET Assembly

When converting script to .NET Assembly, map ls command to Session.ListDirectory method and print returned RemoteDirectoryInfo in your preferred format.

Parameters mapping: Command parameter directory/wildcard maps to method parameter path. You have to convert relative path to absolute path.

For example, following script snippet:

cd /home/martinp
ls 

maps to following PowerShell code:

$directory = $session.ListDirectory("/home/martinp")
 
foreach ($fileInfo in $directory.Files)
{
 Write-Host ("{0}{1} {2,9} {3,-12:MMM dd HH:mm:ss yyyy} {4}" -f
 $fileInfo.FileType, $fileInfo.FilePermissions, $fileInfo.Length,
 $fileInfo.LastWriteTime, $fileInfo.Name)
}

Note that this omits inode, owner and group as these are not available in .NET assembly.

  1. Only single include mask can be specified.Back

Last modified: by martin

AltStyle によって変換されたページ (->オリジナル) /