Skip to content

Move WinSCPItem

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

Move-WinSCPItem

SYNOPSIS

Moves remote file to another remote directory and/or renames remote file.

SYNTAX

Set 1

Move-WinSCPItem [-Path] <String[]> [[-Destination] <String>] -WinSCPSession <Session> [-Force] [-PassThru] [<CommonParameters>]

DESCRIPTION

Moves remote file to another remote directory and/or renames remote file.

EXAMPLES

EXAMPLE 1

PS C:\> Move-WinSCPItem -Path "ftpDoc1.txt" -Destination "ftpDir1/"

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:\> Move-WinSCPItem -Path "ftpDir1/ftpDoc1.txt" -Destination "/" -PassThru


   Directory: ./

Mode                  LastWriteTime     Length Name
----                  -------------     ------ ----
---------      6/30/2017 8:50:52 AM          0 ftpDoc1.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 remote file to move/rename.

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

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

Destination

Full path to new location and name to move/rename the file to.

Type: String
Parameter Sets: Set 1
Aliases: 

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

Force

Overwrite destination if it exists.

Type: SwitchParameter
Parameter Sets: Set 1
Aliases: 

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

PassThru

Gets the RemoteFileInfo object from the new path.

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.Void

NOTES

Destination Formating

The name must be included or the target page has to end with a slash.

RELATED LINKS

Online version:

WinSCP reference:

Generated by: PowerShell HelpWriter 2017 v2.1.36