AfterConnect Parameter (Remove-SFTP Cmdlet)

A set of FTP commands to be executed immediately after connecting to the Server .

Syntax

Remove-SFTP -AfterConnect string[]

Remarks

AfterConnect is a script that is executed immediately following a successful connection.

The script may contain any number of standard FTP commands.

Each line in the script is treated as a single command. By default, if the cmdlet encounters any errors while executing a command, it will log the error message and will continue to process the script. This behavior can be turned off by inserting "ONERROR FAIL" at any point in the script, which will cause the script to terminate on error but will not interrupt the normal operation of the cmdlet. The default behavior can be restored at any point in the script by inserting the line "ONERROR RESUME".

Valid additional scripting commands are listed below:

cd PathChange the remote directory to the specified path.
del FilenameDelete the specified file from the remote server.
mkdir DirectoryCreate the specified remote directory on the server.
rn Filename NewFilenameRename the remote file specified by Filename to the NewFilename.
move Filename NewFilenameMove the remote file located at Filename to the NewFilename.
rm FilenameRemove the specified file from the remote server.
rmdir DirectoryRemove the remote directory from the server.

Supported Macros

The cmdlet also support the following Macros. These values are not case sensitive and would be supplied to a property in the form %MacroName%.

TempThis is resolved to the full path to the system's temporary directory.
SourceFileNameThe original file name. This includes the extension and excludes the file path, for example, Sample.xml. This macro is only applicable to AfterDownload, AfterUpload, and AfterDelete.
DateTime:CustomFormatThis special value allows you to specify your own custom time format. For instance DateTime:yyyy would be resolved to the 4 digit year.
DateThe date format yyyy-MM-dd.
DateTimeThe date format yyyy-MM-ddThhmmss.
TimeThe date format hhmmss.
DateTime_BTS2000The date format yyyyMMddhhmmssf.
DateTime.TZThe date format yyyy-MM-ddThhmmsszzz.
Time.TZThe date format hhmmsszzz.

Default Value

null

Copyright (c) 2022 /n software inc. - All rights reserved.
NetCmdlets 2020 - Version 20.0 [Build 8319]