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: Upload Files

navidnr wrote:

I write a script for connecting to my sftp server and after that I dont know how to set my start point and destination with put command.

put C:\source\path\* /destination/path/
See https://winscp.net/eng/docs/scriptcommand_put
navidnr

Upload Files

Hello
I am currently trying for upload some of my files from my client system to sftp server.
I want to use put command and then use delete switch for removing them.
I write a script for connecting to my sftp server and after that I dont know how to set my start point and destination with put command.
I will be really glad if you can help me.
jason1500

Ok here's the log when I use a file mask, in this case *.pdf (i've removed sensitive information)


. 2017-10-19 10:38:42.196 --------------------------------------------------------------------------

. 2017-10-19 10:38:42.196 WinSCP Version 5.11.2 (Build 7781) (OS 6.2.9200 - Windows Server 2012 Standard)
. 2017-10-19 10:38:42.196 Configuration: nul
. 2017-10-19 10:38:42.196 Log level: Normal
. 2017-10-19 10:38:42.196 Local account: REDACTED
. 2017-10-19 10:38:42.196 Working directory: C:\WinSCP
. 2017-10-19 10:38:42.196 Process ID: 33956
. 2017-10-19 10:38:42.197 Command-line: "C:\WinSCP\winscp.exe" /xmllog="C:\Users\Administrator\AppData\Local\Temp\3\wscp7524.019D04B8.tmp" /xmlgroups /xmllogrequired /nointeractiveinput /dotnet=5.11.2  /ini=nul /log="winscp.log"  /console /consoleinstance=_29988_40509418_60
. 2017-10-19 10:38:42.197 Time zone: Current: GMT-4, Standard: GMT-5 (Eastern Standard Time), DST: GMT-4 (Eastern Daylight Time), DST Start: 3/12/2017, DST End: 11/5/2017
. 2017-10-19 10:38:42.198 Login time: Thursday, October 19, 2017 10:38:42 AM
. 2017-10-19 10:38:42.198 --------------------------------------------------------------------------
. 2017-10-19 10:38:42.198 Script: Retrospectively logging previous script records:
> 2017-10-19 10:38:42.198 Script: option batch on
< 2017-10-19 10:38:42.198 Script: batch           on       
< 2017-10-19 10:38:42.198 Script: reconnecttime   120       
> 2017-10-19 10:38:42.198 Script: option confirm off
< 2017-10-19 10:38:42.198 Script: confirm         off       
> 2017-10-19 10:38:42.198 Script: option reconnecttime 120
< 2017-10-19 10:38:42.198 Script: reconnecttime   120       
> 2017-10-19 10:38:42.198 Script: open sftp://REDACTED" -timeout=15
. 2017-10-19 10:38:42.198 --------------------------------------------------------------------------
. 2017-10-19 10:38:42.198 Session name: REDACTED.net(Ad-Hoc site)
. 2017-10-19 10:38:42.198 Host name: REDACTED.net (Port: 2222)
. 2017-10-19 10:38:42.198 User name: USERNAME (Password: Yes, Key file: No, Passphrase: No)
. 2017-10-19 10:38:42.198 Tunnel: No
. 2017-10-19 10:38:42.198 Transfer Protocol: SFTP
. 2017-10-19 10:38:42.198 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2017-10-19 10:38:42.198 Disable Nagle: No
. 2017-10-19 10:38:42.198 Proxy: None
. 2017-10-19 10:38:42.198 Send buffer: 262144
. 2017-10-19 10:38:42.198 SSH protocol version: 2; Compression: No
. 2017-10-19 10:38:42.198 Bypass authentication: No
. 2017-10-19 10:38:42.198 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: Yes
. 2017-10-19 10:38:42.198 GSSAPI: Forwarding: No
. 2017-10-19 10:38:42.198 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2017-10-19 10:38:42.198 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2017-10-19 10:38:42.198 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2017-10-19 10:38:42.198 Simple channel: Yes
. 2017-10-19 10:38:42.198 Return code variable: Autodetect; Lookup user groups: Auto
. 2017-10-19 10:38:42.198 Shell: default
. 2017-10-19 10:38:42.198 EOL: LF, UTF: Auto
. 2017-10-19 10:38:42.198 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2017-10-19 10:38:42.198 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2017-10-19 10:38:42.199 SFTP Bugs: Auto,Auto
. 2017-10-19 10:38:42.199 SFTP Server: default
. 2017-10-19 10:38:42.199 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2017-10-19 10:38:42.199 Cache directory changes: Yes, Permanent: Yes
. 2017-10-19 10:38:42.199 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2017-10-19 10:38:42.199 DST mode: Unix
. 2017-10-19 10:38:42.199 --------------------------------------------------------------------------
. 2017-10-19 10:38:42.199 Looking up host "REDACTED" for SSH connection
. 2017-10-19 10:38:42.225 Connecting to 123.123.123.123 port 2222
. 2017-10-19 10:38:42.237 We claim version: SSH-2.0-WinSCP_release_5.11.2
. 2017-10-19 10:38:42.263 Server version: SSH-2.0-WingFTPserver
. 2017-10-19 10:38:42.263 Using SSH protocol version 2
. 2017-10-19 10:38:42.264 Have a known host key of type rsa2
. 2017-10-19 10:38:42.276 Doing Diffie-Hellman group exchange
. 2017-10-19 10:38:42.287 Doing Diffie-Hellman key exchange with hash SHA-1
. 2017-10-19 10:38:42.364 Host key fingerprint is:
. 2017-10-19 10:38:42.364 ssh-rsa 1024 REDACTED
. 2017-10-19 10:38:42.364 Verifying host key rsa2 REDACTED
. 2017-10-19 10:38:42.365 Host key matches configured key
. 2017-10-19 10:38:42.365 Initialised AES-128 CBC client->server encryption
. 2017-10-19 10:38:42.366 Initialised HMAC-SHA1 client->server MAC algorithm
. 2017-10-19 10:38:42.366 Initialised AES-128 CBC server->client encryption
. 2017-10-19 10:38:42.366 Initialised HMAC-SHA1 server->client MAC algorithm
! 2017-10-19 10:38:42.429 Using username "REDACTED".
. 2017-10-19 10:38:42.441 Server offered these authentication methods: publickey,password
. 2017-10-19 10:38:42.441 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2017-10-19 10:38:42.441 Using stored password.
. 2017-10-19 10:38:42.441 Sent password
. 2017-10-19 10:38:42.453 Access granted
. 2017-10-19 10:38:42.454 Opening session as main channel
. 2017-10-19 10:38:42.465 Opened main channel
. 2017-10-19 10:38:42.570 Started a shell/command
. 2017-10-19 10:38:42.570 --------------------------------------------------------------------------
. 2017-10-19 10:38:42.570 Using SFTP protocol.
. 2017-10-19 10:38:42.570 Doing startup conversation with host.
> 2017-10-19 10:38:42.571 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2017-10-19 10:38:42.589 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2017-10-19 10:38:42.589 SFTP version 3 negotiated.
. 2017-10-19 10:38:42.589 We believe the server has signed timestamps bug
. 2017-10-19 10:38:42.589 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 strings are not mandatory
. 2017-10-19 10:38:42.589 Getting current directory name.
. 2017-10-19 10:38:42.589 Getting real path for '.'
> 2017-10-19 10:38:42.589 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2017-10-19 10:38:42.606 Type: SSH_FXP_NAME, Size: 23, Number: 16
. 2017-10-19 10:38:42.606 Real path is '/'
. 2017-10-19 10:38:42.606 Startup conversation with host finished.
< 2017-10-19 10:38:42.607 Script: Active session: [1] USER
> 2017-10-19 10:38:42.984 Script: pwd
< 2017-10-19 10:38:42.984 Script: /
> 2017-10-19 10:38:43.048 Script: put  -nopermissions -preservetime -transfer="binary" -- "C:\ftp\FOLDER\*.pdf" "/test/from-FOLDER/docs/"
. 2017-10-19 10:38:43.049 Copying 1 files/directories to remote directory "/test/from-FOLDER/docs/" - total size: 116,128
. 2017-10-19 10:38:43.049   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask:
. 2017-10-19 10:38:43.049   TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; InclM: ; ResumeL: 0
. 2017-10-19 10:38:43.049   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2017-10-19 10:38:43.050 File: 'C:\ftp\FOLDER\fw4.pdf' [2017-10-19T03:54:21.703Z] [116128]
. 2017-10-19 10:38:43.050 Copying "C:\ftp\FOLDER\fw4.pdf" to remote directory started.
. 2017-10-19 10:38:43.050 Binary transfer mode selected.
. 2017-10-19 10:38:43.050 Checking existence of file.
> 2017-10-19 10:38:43.050 Type: SSH_FXP_LSTAT, Size: 40, Number: 263
< 2017-10-19 10:38:43.067 Type: SSH_FXP_STATUS, Size: 32, Number: 263
< 2017-10-19 10:38:43.067 Status code: 2
. 2017-10-19 10:38:43.067 Checking existence of partially transferred file.
> 2017-10-19 10:38:43.067 Type: SSH_FXP_LSTAT, Size: 49, Number: 519
< 2017-10-19 10:38:43.084 Type: SSH_FXP_STATUS, Size: 32, Number: 519
< 2017-10-19 10:38:43.084 Status code: 2
. 2017-10-19 10:38:43.084 Opening remote file.
> 2017-10-19 10:38:43.084 Type: SSH_FXP_OPEN, Size: 65, Number: 771
< 2017-10-19 10:38:43.102 Type: SSH_FXP_HANDLE, Size: 51, Number: 771
> 2017-10-19 10:38:43.102 Type: SSH_FXP_WRITE, Size: 16380, Number: 1286
. 2017-10-19 10:38:43.107 7 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2017-10-19 10:38:43.107 Type: SSH_FXP_CLOSE, Size: 51, Number: 3332
< 2017-10-19 10:38:43.154 Type: SSH_FXP_STATUS, Size: 25, Number: 1286
< 2017-10-19 10:38:43.155 Status code: 0
< 2017-10-19 10:38:43.155 Type: SSH_FXP_STATUS, Size: 25, Number: 1542
< 2017-10-19 10:38:43.155 Status code: 0
< 2017-10-19 10:38:43.155 Type: SSH_FXP_STATUS, Size: 25, Number: 1798
< 2017-10-19 10:38:43.155 Status code: 0
< 2017-10-19 10:38:43.218 Type: SSH_FXP_STATUS, Size: 25, Number: 2054
< 2017-10-19 10:38:43.218 Status code: 0
< 2017-10-19 10:38:43.218 Type: SSH_FXP_STATUS, Size: 25, Number: 2310
< 2017-10-19 10:38:43.218 Status code: 0
< 2017-10-19 10:38:43.218 Type: SSH_FXP_STATUS, Size: 25, Number: 2566
< 2017-10-19 10:38:43.218 Status code: 0
< 2017-10-19 10:38:43.218 Type: SSH_FXP_STATUS, Size: 25, Number: 2822
< 2017-10-19 10:38:43.218 Status code: 0
< 2017-10-19 10:38:43.218 Type: SSH_FXP_STATUS, Size: 25, Number: 3078
< 2017-10-19 10:38:43.218 Status code: 0
< 2017-10-19 10:38:43.218 Type: SSH_FXP_STATUS, Size: 17, Number: 3332
< 2017-10-19 10:38:43.218 Status code: 0
> 2017-10-19 10:38:43.218 Type: SSH_FXP_RENAME, Size: 84, Number: 3602
< 2017-10-19 10:38:43.236 Type: SSH_FXP_STATUS, Size: 42, Number: 3602
< 2017-10-19 10:38:43.236 Status code: 0
. 2017-10-19 10:38:43.236 Preserving timestamp [2017-10-19T03:54:21.000Z]
> 2017-10-19 10:38:43.236 Type: SSH_FXP_SETSTAT, Size: 52, Number: 1033
< 2017-10-19 10:38:43.253 Type: SSH_FXP_STATUS, Size: 48, Number: 1033
< 2017-10-19 10:38:43.253 Status code: 0
. 2017-10-19 10:38:43.253 Transfer done: 'C:\ftp\FOLDER\fw4.pdf' => '/test/from-FOLDER/docs/fw4.pdf' [116128]
. 2017-10-19 10:38:43.254 Copying finished: Transferred: 116,128, Elapsed: 0:00:00, CPS: 635,738/s
> 2017-10-19 10:38:43.310 Script: exit
. 2017-10-19 10:38:43.310 Script: Exit code: 0
. 2017-10-19 10:38:43.310 Closing connection.
. 2017-10-19 10:38:43.310 Sending special code: 12
. 2017-10-19 10:38:43.311 Sent EOF message



Here's the code when I just use * or *.* for the file mask. It looks like the trouble is it's trying to copy a subdirectory and I don't have permission to create a director on the remote ftp site. Which I don't want to do. I just want to copy the files in the directory not any sub folders is this possible to do? I can work around it by moving the archive folder to a different location (I tested that and it worked) but would rather keep it all in the same place if this can be accomplished? Thanks

. 2017-10-19 10:36:29.814 --------------------------------------------------------------------------

. 2017-10-19 10:36:29.814 WinSCP Version 5.11.2 (Build 7781) (OS 6.2.9200 - Windows Server 2012 Standard)
. 2017-10-19 10:36:29.814 Configuration: nul
. 2017-10-19 10:36:29.814 Log level: Normal
. 2017-10-19 10:36:29.814 Local account: REDACTED
. 2017-10-19 10:36:29.815 Working directory: C:\WinSCP
. 2017-10-19 10:36:29.815 Process ID: 22100
. 2017-10-19 10:36:29.815 Command-line: "C:\WinSCP\winscp.exe" /xmllog="C:\Users\Administrator\AppData\Local\Temp\3\wscp7524.027A17C3.tmp" /xmlgroups /xmllogrequired /nointeractiveinput /dotnet=5.11.2  /ini=nul /log="winscp.log"  /console /consoleinstance=_29988_51882379_501
. 2017-10-19 10:36:29.816 Time zone: Current: GMT-4, Standard: GMT-5 (Eastern Standard Time), DST: GMT-4 (Eastern Daylight Time), DST Start: 3/12/2017, DST End: 11/5/2017
. 2017-10-19 10:36:29.816 Login time: Thursday, October 19, 2017 10:36:29 AM
. 2017-10-19 10:36:29.816 --------------------------------------------------------------------------
. 2017-10-19 10:36:29.816 Script: Retrospectively logging previous script records:
> 2017-10-19 10:36:29.816 Script: option batch on
< 2017-10-19 10:36:29.816 Script: batch           on       
< 2017-10-19 10:36:29.816 Script: reconnecttime   120       
> 2017-10-19 10:36:29.816 Script: option confirm off
< 2017-10-19 10:36:29.816 Script: confirm         off       
> 2017-10-19 10:36:29.816 Script: option reconnecttime 120
< 2017-10-19 10:36:29.816 Script: reconnecttime   120       
> 2017-10-19 10:36:29.816 Script: open sftp://REDACTED.net:2222 -hostkey="ssh-rsa 1024 REDACTED" -timeout=15
. 2017-10-19 10:36:29.816 --------------------------------------------------------------------------
. 2017-10-19 10:36:29.816 Session name: REDACTED.net (Ad-Hoc site)
. 2017-10-19 10:36:29.816 Host name: REDACTED.net (Port: 2222)
. 2017-10-19 10:36:29.816 User name: REDACTED (Password: Yes, Key file: No, Passphrase: No)
. 2017-10-19 10:36:29.816 Tunnel: No
. 2017-10-19 10:36:29.816 Transfer Protocol: SFTP
. 2017-10-19 10:36:29.816 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2017-10-19 10:36:29.816 Disable Nagle: No
. 2017-10-19 10:36:29.816 Proxy: None
. 2017-10-19 10:36:29.816 Send buffer: 262144
. 2017-10-19 10:36:29.816 SSH protocol version: 2; Compression: No
. 2017-10-19 10:36:29.816 Bypass authentication: No
. 2017-10-19 10:36:29.816 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: Yes
. 2017-10-19 10:36:29.816 GSSAPI: Forwarding: No
. 2017-10-19 10:36:29.816 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2017-10-19 10:36:29.816 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2017-10-19 10:36:29.816 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2017-10-19 10:36:29.817 Simple channel: Yes
. 2017-10-19 10:36:29.817 Return code variable: Autodetect; Lookup user groups: Auto
. 2017-10-19 10:36:29.817 Shell: default
. 2017-10-19 10:36:29.817 EOL: LF, UTF: Auto
. 2017-10-19 10:36:29.817 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2017-10-19 10:36:29.817 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2017-10-19 10:36:29.817 SFTP Bugs: Auto,Auto
. 2017-10-19 10:36:29.817 SFTP Server: default
. 2017-10-19 10:36:29.817 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2017-10-19 10:36:29.817 Cache directory changes: Yes, Permanent: Yes
. 2017-10-19 10:36:29.817 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2017-10-19 10:36:29.817 DST mode: Unix
. 2017-10-19 10:36:29.817 --------------------------------------------------------------------------
. 2017-10-19 10:36:29.817 Looking up host "REDACTED.net" for SSH connection
. 2017-10-19 10:36:29.870 Connecting to REDACTED port 2222
. 2017-10-19 10:36:29.882 We claim version: SSH-2.0-WinSCP_release_5.11.2
. 2017-10-19 10:36:29.907 Server version: SSH-2.0-WingFTPserver
. 2017-10-19 10:36:29.907 Using SSH protocol version 2
. 2017-10-19 10:36:29.908 Have a known host key of type rsa2
. 2017-10-19 10:36:29.919 Doing Diffie-Hellman group exchange
. 2017-10-19 10:36:29.931 Doing Diffie-Hellman key exchange with hash SHA-1
. 2017-10-19 10:36:30.010 Host key fingerprint is:
. 2017-10-19 10:36:30.010 ssh-rsa 1024 REDACTED
. 2017-10-19 10:36:30.010 Verifying host key rsa2   REDACTED
. 2017-10-19 10:36:30.011 Host key matches configured key
. 2017-10-19 10:36:30.011 Initialised AES-128 CBC client->server encryption
. 2017-10-19 10:36:30.011 Initialised HMAC-SHA1 client->server MAC algorithm
. 2017-10-19 10:36:30.011 Initialised AES-128 CBC server->client encryption
. 2017-10-19 10:36:30.011 Initialised HMAC-SHA1 server->client MAC algorithm
! 2017-10-19 10:36:30.070 Using username "REDACTED".
. 2017-10-19 10:36:30.081 Server offered these authentication methods: publickey,password
. 2017-10-19 10:36:30.081 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2017-10-19 10:36:30.081 Using stored password.
. 2017-10-19 10:36:30.081 Sent password
. 2017-10-19 10:36:30.093 Access granted
. 2017-10-19 10:36:30.093 Opening session as main channel
. 2017-10-19 10:36:30.105 Opened main channel
. 2017-10-19 10:36:30.210 Started a shell/command
. 2017-10-19 10:36:30.211 --------------------------------------------------------------------------
. 2017-10-19 10:36:30.211 Using SFTP protocol.
. 2017-10-19 10:36:30.211 Doing startup conversation with host.
> 2017-10-19 10:36:30.211 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2017-10-19 10:36:30.229 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2017-10-19 10:36:30.229 SFTP version 3 negotiated.
. 2017-10-19 10:36:30.229 We believe the server has signed timestamps bug
. 2017-10-19 10:36:30.229 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 strings are not mandatory
. 2017-10-19 10:36:30.229 Getting current directory name.
. 2017-10-19 10:36:30.229 Getting real path for '.'
> 2017-10-19 10:36:30.229 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2017-10-19 10:36:30.246 Type: SSH_FXP_NAME, Size: 23, Number: 16
. 2017-10-19 10:36:30.246 Real path is '/'
. 2017-10-19 10:36:30.246 Startup conversation with host finished.
< 2017-10-19 10:36:30.246 Script: Active session: [1] REDACTED.net
> 2017-10-19 10:36:30.634 Script: pwd
< 2017-10-19 10:36:30.634 Script: /
> 2017-10-19 10:36:30.715 Script: put  -nopermissions -preservetime -transfer="binary" -- "C:\ftp\FOLDER\*" "/test/from-FOLDER/docs/"
. 2017-10-19 10:36:30.715 Copying 1 files/directories to remote directory "/test/from-folder/docs/"
. 2017-10-19 10:36:30.715   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask:
. 2017-10-19 10:36:30.716   TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; InclM: ; ResumeL: 0
. 2017-10-19 10:36:30.716   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2017-10-19 10:36:30.716 File: 'C:\ftp\FOLDER\Archive' [2017-10-19T04:24:16.467Z] [0]
. 2017-10-19 10:36:30.716 Trying to open directory "/test/from-FOLDER/docs/Archive/".
> 2017-10-19 10:36:30.716 Type: SSH_FXP_LSTAT, Size: 41, Number: 263
< 2017-10-19 10:36:30.733 Type: SSH_FXP_STATUS, Size: 32, Number: 263
< 2017-10-19 10:36:30.733 Status code: 2, Message: 263, Server: File not found., Language: 
. 2017-10-19 10:36:30.733 Creating directory "/test/from-FOLDER/docs/Archive/".
. 2017-10-19 10:36:30.733 Canonifying: "/test/from-FOLDER/docs/Archive/"
. 2017-10-19 10:36:30.733 Getting real path for '/test/from-FOLDER/docs/Archive/'
> 2017-10-19 10:36:30.733 Type: SSH_FXP_REALPATH, Size: 41, Number: 784
< 2017-10-19 10:36:30.750 Type: SSH_FXP_STATUS, Size: 66, Number: 784
< 2017-10-19 10:36:30.750 Status code: 2, Message: 784, Server: "/test/from-FOLDER/docs/Archive/": No such file., Language: 
. 2017-10-19 10:36:30.750 Getting real path for '/test/from-FOLDER/docs/'
> 2017-10-19 10:36:30.750 Type: SSH_FXP_REALPATH, Size: 33, Number: 1040
< 2017-10-19 10:36:30.767 Type: SSH_FXP_NAME, Size: 67, Number: 1040
. 2017-10-19 10:36:30.767 Real path is '/test/from-FOLDER/docs'
. 2017-10-19 10:36:30.767 Canonified: "/test/from-FOLDER/docs/Archive"
> 2017-10-19 10:36:30.767 Type: SSH_FXP_MKDIR, Size: 44, Number: 526
< 2017-10-19 10:36:30.784 Type: SSH_FXP_STATUS, Size: 54, Number: 526
< 2017-10-19 10:36:30.784 Status code: 3, Message: 526, Server: Cannot make directory. No permission., Language: 
. 2017-10-19 10:36:30.784 Asking user:
. 2017-10-19 10:36:30.784 Error creating folder '/test/from-FOLDER/docs/Archive/'. ("Permission denied.
. 2017-10-19 10:36:30.784 Error code: 3
. 2017-10-19 10:36:30.784 Error message from server: Cannot make directory. No permission.")
< 2017-10-19 10:36:30.784 Script: Error creating folder '/test/from-FOLDER/docs/Archive/'.
< 2017-10-19 10:36:30.784 Script: Permission denied.
< 2017-10-19 10:36:30.784 Error code: 3
< 2017-10-19 10:36:30.784 Error message from server: Cannot make directory. No permission.
. 2017-10-19 10:36:30.785 Script: Failed
> 2017-10-19 10:36:30.927 Script: exit
. 2017-10-19 10:36:30.927 Script: Exit code: 1
. 2017-10-19 10:36:30.927 Closing connection.
. 2017-10-19 10:36:30.927 Sending special code: 12
. 2017-10-19 10:36:30.927 Sent EOF message
martin

Re: Moving local files to different location after successful upload Script Help

Show us a log file.
$session.SessionLogPath = "winscp.log"
(before $session.Open($sessionOptions)).
jason1500

Moving local files to different location after successful upload Script Help

Hi hope someone can help me out. I found this script here which almost does exactly what I need it too. https://winscp.net/eng/docs/script_local_move_after_successful_upload

I set my local, remote, and backup paths.

However it only works if I set a file mask for the local path.
For example $localPath = "C:\upload\*.pdf", works fine, the file uploads to the specified FTP and then copies the file to the backup path. That's great if I only need to upload pdfs or whatever file extension I need, but I want to to upload all files in that folder not one specific extension, is that possible or no?

If I set it to either $localPath = "C:\upload\*.*", or keep it at $localPath = "C:\upload\*", The script runs without uploading or moving anything. I hit enter, it pauses for a moment and I'm back at another prompt with no message of success or error, no files moved or uploaded. I'm running the script via powershell with admin access and running the command ./test.ps1 I've downloaded the latest winscp automation zip and I extracted it and running the script from within the winscp folder.

Any help would be greatly appreciated. Thanks!