Skip to content

Get WinSCPChildItem

Thomas Malkewitz edited this page Sep 6, 2017 · 19 revisions

Get-WinSCPChildItem

SYNOPSIS

Gets the items and child items in one or more specified locations.

SYNTAX

Set 1

Get-WinSCPChildItem [[-Path] <String[]>] -WinSCPSession <Session> [-Filter <String>] [-Recurse] [-Depth <Int32>] [-Name] [-Directory] [-File] [<CommonParameters>]

DESCRIPTION

Gets the items and child items in one or more specified locations.

EXAMPLES

EXAMPLE 1

PS C:\> Get-WinSCPChildItem


   Directory: ./

Mode                  LastWriteTime     Length Name
----                  -------------     ------ ----
---------      6/30/2017 8:50:37 AM            ftpDir1
---------      6/30/2017 8:50:44 AM            ftpDir2
---------      6/30/2017 8:50:52 AM          0 ftpDoc1.txt
---------      6/30/2017 8:50:52 AM          0 ftpDoc2.txt

EXAMPLE 2

PS C:\> $sessionOption = New-WinSCPSessionOption -HostName $env:COMPUTERNAME -Protocol Ftp
PS C:\> New-WinSCPSession -SessionOption $sessionOption


Opened       Timeout HostName
------       ------- --------
True        00:01:00 ftp.dotps1.github.io


PS C:\> Get-WinChildItem -File


   Directory: ./

Mode                  LastWriteTime     Length Name
----                  -------------     ------ ----
---------      6/30/2017 8:50:52 AM          0 ftpDoc1.txt
---------      6/30/2017 8:50:52 AM          0 ftpDoc2.txt


PS C:\> Remove-WinSCPSession

PARAMETERS

WinSCPSession

It represents a session and provides methods for manipulating remote files over SFTP, SCP or FTP session.

Type: Session
Parameter Sets: Set 1
Aliases: 

Required: true
Position: named
Default Value: 
Pipeline Input: True (ByPropertyName)

Path

Full path to root remote directory to start enumeration in.

Type: String[]
Parameter Sets: Set 1
Aliases: 

Required: false
Position: 0
Default Value: 
Pipeline Input: True (ByPropertyName, ByValue)

Filter

Windows wildcard to filter files. To select all files, use null.

Type: String
Parameter Sets: Set 1
Aliases: 

Required: false
Position: named
Default Value: null
Pipeline Input: false

Recurse

Recurse into subdirectories.

Type: SwitchParameter
Parameter Sets: Set 1
Aliases: 

Required: false
Position: named
Default Value: 
Pipeline Input: false

Depth

The amount of directories to recurse.

Type: Int32
Parameter Sets: Set 1
Aliases: 

Required: false
Position: named
Default Value: 
Pipeline Input: false

Name

Gets only the names of the items in the locations.

Type: SwitchParameter
Parameter Sets: Set 1
Aliases: 

Required: false
Position: named
Default Value: 
Pipeline Input: false

Directory

Select directory objects only.

Type: SwitchParameter
Parameter Sets: Set 1
Aliases: 

Required: false
Position: named
Default Value: 
Pipeline Input: false

File

Select file objects only.

Type: SwitchParameter
Parameter Sets: Set 1
Aliases: 

Required: false
Position: named
Default Value: 
Pipeline Input: false

<CommonParameters>

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

WinSCP.Session

System.String[]

OUTPUTS

System.Array

NOTES

Using Directory and File switches together.

If both -Directory and -File switches are used, return nothing. This mimics the functionality of Get-ChildItem.

RELATED LINKS

Online version:

WinSCP reference:

Generated by: PowerShell HelpWriter 2017 v2.1.36