Topic "Execute remote command for each file during synchronization"

Author Message
pr3st00
[View user's profile]

Joined: 2013-07-04
Posts: 1
Location: Brazil
Hi there,

I have just created some useful scripts here for synchronizing my local filesystem with a unix box where the codebase for a particular application is hosted (we cannot run the version control locally because of network latency). I was able to remotely call the commands for updating the codebase and then calling synchronize works great!

However,

I'm trying to work on the other way around now. I need to push my local changes over to the unix box, but for that I need to check out each new file before I can transfer them. Is there any way using winscp scripting to run a specific command for each file being copied?

I couldn't find anything related, so I'm guessing there's no such feature...

Thanks,

Fernando Almeida
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
Why don't you check the files before you run WinSCP script?
_________________
Martin Prikryl
Guest




prikryl wrote:
Why don't you check the files before you run WinSCP script?


That's exactly how I'm doing today, but that's error prone and time consuming.

If for any reason I forgot to check out a particular file, the copying process will fail with permission denied. Also, the process of check out a file (specially if we're talking about a lot of them) takes a considerably amount of time.

I wanted something really simple, similar to what I'm doing for synching from the remote codebase to my local filesystem: you run a single command and the work is done. Maybe that's not possible by simply using winscp scripting....

Thanks!

Fernando
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
No, that's definitely not possible using WinSCP scripting. You would have to implement the synchronization on your own, for example using WinSCP .NET assembly from PowerShell script. In such script you can add any check you want.

You can base your solution on following example:
https://winscp.net/eng/docs/library_session_getfiles#powershell
You will also need directory listing:
https://winscp.net/eng/docs/library_session_listdirectory#example

General info:
https://winscp.net/eng/docs/library_powershell
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License