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: WinSCP creating entire directory structure

There's no simple command for this.

You would have code this yourself using WinSCP .NET assembly from a PowerShell script:
https://winscp.net/eng/docs/library
joober

WinSCP creating entire directory structure

Hello all,

I am using WinSCP to automate uploading files to a partner we work with. On our side, we have a large directory with many subdirectories. I have made a script that is run once per day which should upload all files changed within the last 24 hours. I use the code below to do the actual uploading:

put -filemask="*>1D" \\server\share\source /Remotedir/destination


At the destination, they only need the changed files. Files and folders they are finished with, get deleted from the destination server. The problem I have is that this command works, meaning it transfers the changed files. However, it also seems to recreate the entire directory structure from the source at the destination. This is a problem for them, since they have to hunt this structure for the changed files. Is there a way I can get it to only create the directories that contain new or changed files?

I have included a snippet of the log to show the process in the hope it might be helpful.

. 2015-07-20 18:11:22.605 Trying to open directory "/Remotedir/destination/AS 2006027/".

> 2015-07-20 18:11:22.605 Type: SSH_FXP_LSTAT, Size: 57, Number: 519
< 2015-07-20 18:11:22.621 Type: SSH_FXP_STATUS, Size: 29, Number: 519
< 2015-07-20 18:11:22.621 Status code: 2, Message: 519, Server: No such file, Language: 
. 2015-07-20 18:11:22.621 Creating directory "/Remotedir/destination/AS 2006027/".
. 2015-07-20 18:11:22.636 Canonifying: "/Remotedir/destination/AS 2006027/"
. 2015-07-20 18:11:22.636 Getting real path for '/Remotedir/destination/AS 2006027/'
> 2015-07-20 18:11:22.636 Type: SSH_FXP_REALPATH, Size: 53, Number: 1040
< 2015-07-20 18:11:22.652 Type: SSH_FXP_STATUS, Size: 34, Number: 1040
< 2015-07-20 18:11:22.652 Status code: 3, Message: 1040, Server: Permission denied, Language: 


I'd appreciate any insights.