Transfer files from sftp site to server (Folder to Folder match)

Advertisement

Syed Jalal
Guest

Transfer files from sftp site to server (Folder to Folder match)

Dear Forum members,
Kindly help me. I am looking for a batch command script file to connect to sftp site from the server. Upon connecting to the sftp site under the main folder, i will be having different sub-folders. Each sub-folder has files. These files need to be moved to server C:\main-folder\sub-folder. The sub-folder in the sftp site is same as sub-folder in the server side. Hence i need to match the sub-folder name from sftp site to server sub-folder site and then transfer the files. Upon copying the files from sub-folder of sftp site, i need to delete these files from sftp site. Appreciate your kind help my friends.

Regards
Syed Jalal

Reply with quote

Advertisement

Syed Jalal
Guest

Transfer files from sftp site to server (Folder to Folder match)

Hi Martin,
I have gone through the URL link for the script. Couple of questions i have:
1) open sftp://user:password@server-ip-address/ -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..."
Once I use the above command it will automatically connect to SFTP server, right?
LCD /source-folder-name
Inside the source-folder i have several sub-folders. How to synchronize the files present in each sub-folder with the destination server (Example given below)
source-folder : destination-folder
A6-FGA A6-FGA
A6-FGE A6-FGE
A6-FGJ A-FGJ
I need to synchronize files from source to destination and afterthat i need to delete the files present in each of above sub-folder.
Kindly let me know the commands i need to use in the ftp script.

Regards
Syed Jalal

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,378
Location:
Prague, Czechia

Re: Transfer files from sftp site to server (Folder to Folder match)

Syed Jalal wrote:

1) open sftp://user:password@server-ip-address/ -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..."
Once I use the above command it will automatically connect to SFTP server, right?
Yes.

I need to synchronize files from source to destination and afterthat i need to delete the files present in each of above sub-folder.
Kindly let me know the commands i need to use in the ftp script.
Start here: https://winscp.net/eng/docs/faq_delete_synchronized_files

Reply with quote

Advertisement

You can post new topics in this forum