powerhell: rhestru cyfeiriadur ftp (help ar sgript)

Rwy'n ceisio gwneud golwg rhestr o gyfeiriadur ftp. Mae'r rhan wylio yn iawn hyd yn hyn ond ni allaf drin y data rwy'n ei gael yn ôl. Dyma'r sgript a ddefnyddiais;

[System.Net.FtpWebRequest]$ftp = [System.Net.WebRequest]::Create("ftp://ftp.microsoft.com/ResKit/y2kfix/alpha/") 
$ftp.Method = [System.Net.WebRequestMethods+FTP]::ListDirectory #Details

$response = $ftp.getresponse() 
$stream = $response.getresponsestream() 

$buffer = new-object System.Byte[] 1024 
$encoding = new-object System.Text.AsciiEncoding 

$outputBuffer = "" 
$foundMore = $false 

## Read all the data available from the stream, writing it to the 
## output buffer when done. 
do 
{ 
    ## Allow data to buffer for a bit 
    start-sleep -m 1000 

    ## Read what data is available 
    $foundmore = $false 
    $stream.ReadTimeout = 1000

    do 
    { 
        try 
        { 
            $read = $stream.Read($buffer, 0, 1024) 

            if($read -gt 0) 
            { 
                $foundmore = $true 
                $outputBuffer += ($encoding.GetString($buffer, 0, $read)) 
            } 
        } catch { $foundMore = $false; $read = 0 } 
    } while($read -gt 0) 
} while($foundmore)

$outputBuffer

Dyma'r ymateb rwy'n ei gael yn ôl ar gyfer y sgript hon;

PS C:\Users\Toshiba> C:\Apps\@PowerShell\FTPListDirectory.ps1
forfiles.exe
logtime.exe
timeserv
w32time

O'r fan honno, sut y gallaf weithio ar y data rwy'n ei gael yn ôl. gwybodaeth y ffeil (enw, amser creu, diweddariad diwethaf, ac ati) a'r pethau eraill.

Fy nod yma yw gweld yr holl ddata ftp mewn cyfeiriadur ac yna gallaf lawrlwytho'r holl ffeiliau mewn cyfeiriadur.

Unrhyw siawns?

6
задан billinkc 13 August 2011 в 21:37
поделиться