Synchronise script won't get new files

Advertisement

bbgmp
Guest

Synchronise script won't get new files

I've been going through the documentation on how to run a synchronise script and can't seem to get it to actually download anything.

I have an SFTP directory which gets populated from another source, I'd like to download all new files to a local directory on a daily basis. If a file is deleted on the remote directory I'd like this to be automatically deleted from the local directory.

I've created a session which specifies the following:

    Host name
    user name
    password
    file protocol (SFTP)
    remote directory
    local directory

I've then created a .bat script with the following:

winscp.com /script=sync.txt /defaults

This calls the following script:

option batch abort
option confirm off
option reconnecttime 30
open <session>
option transfer binary
synchronize local -delete
close
exit

The script successfully opens the session and connects to the host. The correct directories are listed, however nothing is transferred.

If I create a new file or folder in the local directory, these are deleted when the script is run so I can tell at least some of the settings are working OK.

If I open the session and run a sync command through the GUI it works OK so I have no idea why it's not working in the script.

Any help would be greatly appreciated.

Cheers.

Reply with quote

Advertisement

bbgmp
Guest

OK - Having read through some of the other threads I did as was suggested earlier and added...

lls I:\Downloads\synctest\
ls /mnt/sdg1/files/synctest/
synchronize local -mirror -delete -nopermissions I:\Downloads\synctest\ /mnt/sdg1/files/synctest/

... to my code. Listing the command prompt output below:

batch abort
confirm off
reconnecttime 30
Searching for host...
Connecting to host...
Authenticating...
Using username "bbgmp".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] synctest
12 Apr 2012 09:52 PM <DIR> ..
drwxr-xr-x 3 bbgmp bbgmp 32 Apr 12 22:16:45 2012 .
drwxrwx--- 5 bbgmp bbgmp 45 Apr 12 18:54:07 2012 ..
drwxr-xr-x 2 bbgmp bbgmp 31 Apr 12 22:16:57 2012 sync test directory
Comparing...
Local 'I:\Downloads\synctest' <= Remote '<remote_directory>'
Synchronizing...
Session 'synctest' closed.

Here's the relevant log output for the sync process:

> 2012-04-12 22:31:51.179 Script: synchronize local -mirror -delete -nopermissions I:\Downloads\synctest\ /mnt/sdg1/files/synctest/
< 2012-04-12 22:31:51.179 Script: Comparing...
. 2012-04-12 22:31:51.179 Collecting synchronization list for local directory 'I:\Downloads\synctest\' and remote directory '/mnt/sdg1/files/synctest/', mode = 1, params = 5639
. 2012-04-12 22:31:51.179 Listing directory "/mnt/sdg1/files/synctest".
> 2012-04-12 22:31:51.179 Type: SSH_FXP_OPENDIR, Size: 39, Number: 1547
< 2012-04-12 22:31:51.194 Type: SSH_FXP_STATUS, Size: 24, Number: 1284
. 2012-04-12 22:31:51.194 Discarding reserved response
< 2012-04-12 22:31:51.210 Type: SSH_FXP_HANDLE, Size: 13, Number: 1547
> 2012-04-12 22:31:51.210 Type: SSH_FXP_READDIR, Size: 13, Number: 1804
< 2012-04-12 22:31:51.225 Type: SSH_FXP_NAME, Size: 341, Number: 1804
> 2012-04-12 22:31:51.225 Type: SSH_FXP_READDIR, Size: 13, Number: 2060
< 2012-04-12 22:31:51.241 Type: SSH_FXP_STATUS, Size: 28, Number: 2060
< 2012-04-12 22:31:51.241 Status code: 1
> 2012-04-12 22:31:51.241 Type: SSH_FXP_CLOSE, Size: 13, Number: 2308
< 2012-04-12 22:31:51.241 Script: Synchronizing...
. 2012-04-12 22:31:51.241 Synchronizing local directory 'I:\Downloads\synctest\' with remote directory '/mnt/sdg1/files/synctest/', params = 5639

If I compare this to the log output for a manual sync using the GUI, it's very different:

. 2012-04-12 22:36:43.061 Collecting synchronization list for local directory 'I:\Downloads\synctest' and remote directory '/mnt/sdg1/files/synctest', mode = 1, params = 5699
. 2012-04-12 22:36:43.076 Listing directory "/mnt/sdg1/files/synctest".
> 2012-04-12 22:36:43.076 Type: SSH_FXP_OPENDIR, Size: 39, Number: 1547
< 2012-04-12 22:36:43.076 Type: SSH_FXP_STATUS, Size: 24, Number: 1284
. 2012-04-12 22:36:43.076 Discarding reserved response
< 2012-04-12 22:36:43.092 Type: SSH_FXP_HANDLE, Size: 13, Number: 1547
> 2012-04-12 22:36:43.108 Type: SSH_FXP_READDIR, Size: 13, Number: 1804
< 2012-04-12 22:36:43.123 Type: SSH_FXP_NAME, Size: 341, Number: 1804
> 2012-04-12 22:36:43.123 Type: SSH_FXP_READDIR, Size: 13, Number: 2060
< 2012-04-12 22:36:43.139 Type: SSH_FXP_STATUS, Size: 28, Number: 2060
< 2012-04-12 22:36:43.139 Status code: 1
> 2012-04-12 22:36:43.139 Type: SSH_FXP_CLOSE, Size: 13, Number: 2308
. 2012-04-12 22:36:45.510 Synchronizing local directory 'I:\Downloads\synctest\' with remote directory '/mnt/sdg1/files/synctest/', params = 5699
. 2012-04-12 22:36:45.541 Getting size of directory "/mnt/sdg1/files/synctest/sync test directory"
. 2012-04-12 22:36:45.541 Listing directory "/mnt/sdg1/files/synctest/sync test directory".
> 2012-04-12 22:36:45.541 Type: SSH_FXP_OPENDIR, Size: 59, Number: 2571
< 2012-04-12 22:36:45.541 Type: SSH_FXP_STATUS, Size: 24, Number: 2308
. 2012-04-12 22:36:45.541 Discarding reserved response
< 2012-04-12 22:36:45.572 Type: SSH_FXP_HANDLE, Size: 13, Number: 2571
> 2012-04-12 22:36:45.572 Type: SSH_FXP_READDIR, Size: 13, Number: 2828
< 2012-04-12 22:36:45.588 Type: SSH_FXP_NAME, Size: 339, Number: 2828
> 2012-04-12 22:36:45.588 Type: SSH_FXP_READDIR, Size: 13, Number: 3084
< 2012-04-12 22:36:45.604 Type: SSH_FXP_STATUS, Size: 28, Number: 3084
< 2012-04-12 22:36:45.604 Status code: 1
> 2012-04-12 22:36:45.604 Type: SSH_FXP_CLOSE, Size: 13, Number: 3332
. 2012-04-12 22:36:45.650 File: "/mnt/sdg1/files/synctest/sync test directory"
. 2012-04-12 22:36:45.650 Listing directory "/mnt/sdg1/files/synctest/sync test directory".
> 2012-04-12 22:36:45.650 Type: SSH_FXP_OPENDIR, Size: 59, Number: 3595
< 2012-04-12 22:36:45.650 Type: SSH_FXP_STATUS, Size: 24, Number: 3332
. 2012-04-12 22:36:45.650 Discarding reserved response
< 2012-04-12 22:36:45.666 Type: SSH_FXP_HANDLE, Size: 13, Number: 3595
> 2012-04-12 22:36:45.666 Type: SSH_FXP_READDIR, Size: 13, Number: 3852
< 2012-04-12 22:36:45.697 Type: SSH_FXP_NAME, Size: 339, Number: 3852
> 2012-04-12 22:36:45.697 Type: SSH_FXP_READDIR, Size: 13, Number: 4108
< 2012-04-12 22:36:45.713 Type: SSH_FXP_STATUS, Size: 28, Number: 4108
< 2012-04-12 22:36:45.713 Status code: 1
> 2012-04-12 22:36:45.713 Type: SSH_FXP_CLOSE, Size: 13, Number: 4356
. 2012-04-12 22:36:45.713 File: "/mnt/sdg1/files/synctest/sync test directory/sync test file.jpg"
. 2012-04-12 22:36:45.713 Copying "/mnt/sdg1/files/synctest/sync test directory/sync test file.jpg" to local directory started.
. 2012-04-12 22:36:45.713 Binary transfer mode selected.
. 2012-04-12 22:36:45.713 Opening remote file.
> 2012-04-12 22:36:45.713 Type: SSH_FXP_OPEN, Size: 86, Number: 4611
< 2012-04-12 22:36:45.728 Type: SSH_FXP_STATUS, Size: 24, Number: 4356
. 2012-04-12 22:36:45.728 Discarding reserved response
< 2012-04-12 22:36:45.744 Type: SSH_FXP_HANDLE, Size: 13, Number: 4611
> 2012-04-12 22:36:45.744 Type: SSH_FXP_FSTAT, Size: 13, Number: 4872
> 2012-04-12 22:36:45.744 Type: SSH_FXP_READ, Size: 25, Number: 5125
. 2012-04-12 22:36:45.760 3 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
< 2012-04-12 22:36:45.760 Type: SSH_FXP_ATTRS, Size: 37, Number: 4872
. 2012-04-12 22:36:45.760 Storing reserved response
< 2012-04-12 22:36:45.994 Status code: 1
. 2012-04-12 22:36:45.994 17 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2012-04-12 22:36:45.994 Type: SSH_FXP_CLOSE, Size: 13, Number: 8196
< 2012-04-12 22:36:45.994 Type: SSH_FXP_STATUS, Size: 28, Number: 7429
< 2012-04-12 22:36:45.994 Type: SSH_FXP_STATUS, Size: 28, Number: 7685
< 2012-04-12 22:36:46.009 Type: SSH_FXP_STATUS, Size: 28, Number: 7941

Again, any help would be greatly appreciated. I'm currently out of ideas.

Reply with quote

bbgmp
Guest

I have a feeling this may be down to being able to deselect the Existing files only checkbox in the manual sync dialogue.

Are there any commands which allow all files to be synced when using an automated script?

Reply with quote

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

bbgmp wrote:

I have a feeling this may be down to being able to deselect the Existing files only checkbox in the manual sync dialogue.

Are there any commands which allow all files to be synced when using an automated script?
Scripting picks up whatever settings from the GUI. So configure it in the GUI before running the script.

Reply with quote

Advertisement

You can post new topics in this forum