Solved

UPLOAD FOLDERS TO SFTP USING SCRIPT

  • 16 February 2024
  • 3 replies
  • 58 views

Badge +5

Hello Team,

I have a folder located in a local folder that needs to be transferred to an SFTP server. I possess the necessary PPK key and username for the SFTP access. The source path of the file remains constant, while the destination path may vary daily. I aim to accomplish this task by executing a CMD script within Automation Anywhere.

Can anyone help ???

I'm aware of the FTP/SFTP feature to upload/delete files in AA, but i need to know whether i can possible to upload files/folders without using the feature.

icon

Best answer by Tamil Arasu10 20 February 2024, 09:39

View original

3 replies

Badge +5

@Tamil Arasu10  can you suggest your solution?

 

Userlevel 6
Badge +15

Hi @Vaandu,

CMD script in Automation Anywhere:

1. Prepare your CMD script:

  • Open a text editor and create a new file (.bat extension).
  • Use the pscp command from the WinSCP package to perform the transfer.
  • The syntax is: pscp -pw <password> -i <private_key_path> <local_source_path>  <username>@<sftp_server_address>:<destination_path>

 

Replace the placeholders with your information:

  • <password>: Leave blank if using a private key (PPK).
  • <private_key_path>: Full path to your PPK file.
  • <local_source_path>: Full path to the folder you want to transfer.
  • <username>: Username for SFTP access.
  • <sftp_server_address>: Address of the SFTP server.
  • <destination_path>: Destination path on the SFTP server (you can use variables here)

 

2. Use the "Run Command" action in Automation Anywhere:

  • Create a new Bot in Automation Anywhere.
  • Add the "Open Program/file" action from the "Application" package.
  • In the "Command to run" field, specify the full path to your CMD script.
  • Use the "Dynamic Input" end with* and create a new variable for the daily changing destination path.
  • Map the variable to the corresponding placeholder in the CMD script using curly braces (e.g., <destination_path>{VariableName}).

Test the script and Automation Anywhere bot thoroughly before deployment

 
Badge +5

thanks @Tamil Arasu10 for the great support

Reply