Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Execute remote command for each file during synchronization

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
Guest

Re: Execute remote command for each file during synchronization

martin 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

Re: Execute remote command for each file during synchronization

Why don't you check the files before you run WinSCP script?
pr3st00

Execute remote command for each file during synchronization

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