Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Move files between folder in SFTP Server using Bash Script.

Hello,

I would like to move files from one folder to another in the SFTP server using the Bash Script component.

Can anyone help me with that?

Thank you

3 Community Answers

Matillion Agent  

Damian Chan —

Hello Rishabh,

Is there a specific reason why you would need to use a Bash Script component? The reason why I’m asking is that we have a component which will make the process much easier for you; Data Transfer Component. See the link below for more information.

https://snowflakesupport.matillion.com/customer/en/portal/articles/2953509-data-transfer-component?b_id=16164

Best Regards,
Damian


Rishabh Goswami —

Hello Damian,

Yes, I am aware of this component which copies(not moves permanently) the file from one folder to another.

However, I need to permanently delete the file from the SFTP input folder once it has been copied to the destination folder which the component does not ´provide.

If you could help me with some know-hows , it would be great.

Thanks a ton,
Rishabh


Matillion Agent  

Paul Johnson —

Hi Rishabh,
You can use a bash component with the curl command to interact with your sftp server an example is like this

curl sftp://ipaddress:port -u username:password -Q 'rm file.txt' --insecure

The -Q sends a quoted command to the sftp server. —insecure is used if i don’t have a key in the known hosts folder, be aware this is not a secure protocol I have added it so that “it works” for now.

Regards,
Paul

Post Your Community Answer

To add an answer please login