Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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: keepuptodate doesn't propagate dir deletion to remote server

Thanks. I've seen the problem already. Though I do not know how to resolve it.
AgentConundrum

keepuptodate doesn't propagate dir deletion to remote server

I'm using keepuptodate in a script to keep a directory on my local (WinXP SP3) machine in sync with a remote directory on my shared hosting server (some flavour of Linux, but I don't know specifics).

When I create a new directory locally, the new directory is created on the remote server. If I then delete this directory locally, however, this change does not get reflected on the remote server.

Windows has the additional issue that it's unsure of whether or not the local directory even still exists. Refreshing the explorer pane will show the directory there again, but accessing it throws an error. Once I kill the keepuptodate command in the script, Windows recognizes that the directory really doesn't exist, and deletes it for good locally. The remote directory still exists.

I suspect what is happening is that in watching the subdirectory, WinSCP is keeping a handle open on it. When the command to delete it is given through explorer, it's only "partially deleted" with a command to properly delete it once the hook is released. Since this hook is only released when the keepuptodate command stops, WinSCP doesn't see the deletion and so it doesn't propagate the change to the remote server.

Here is the command line:
"C:\Program Files\WinSCP\WinSCP.com" /command /script=sync.txt

Here is the script:
option batch on
option confirm off
open USER@DOMAIN.ca
synchronize remote -delete "D:\NAME's Documents\My Projects\PROJECT\Project" "/www/PROJECT"
keepuptodate -delete "D:\NAME's Documents\My Projects\PROJECT\Project" "/www/PROJECT"


After running the script I get following in console:
batch on
confirm off
Connecting to DOMAIN.ca ...
Connected with DOMAIN.ca. Waiting for welcome message...
Connected
Starting the session...
Reading remote directory...
Session started.
Active session: [1] USER@DOMAIN.ca
Comparing...
Local 'D:\NAME's Documents\My Projects\PROJECT\Project\admin' => Remote '/www/PROJECT/admin'
Nothing to synchronize.
Watching for changes, press Ctrl-C to abort...
Scanning 'D:\NAME's Documents\My Projects\PROJECT\Project' for subdirectories...
Watching for changes in 2 directories...
Change in 'D:\NAME's Documents\My Projects\PROJECT\Project' detected.
Local 'D:\NAME's Documents\My Projects\PROJECT\Project' => Remote '/www/PROJECT'
D:\...\Project\New Folder | 0 KiB | 0.0 KiB/s | binary | 0%
Watching for changes in 3 directories...
Change in 'D:\NAME's Documents\My Projects\PROJECT\Project\New Folder' detected.
Terminated by user.

Here is the log file I created (I don't see a way to attach a file to this post). Note that the log doesn't show the deletion of the directory at all:

. 2011-08-06 05:26:45.734 --------------------------------------------------------------------------
. 2011-08-06 05:26:45.734 WinSCP Version 4.3.4 (Build 1428) (OS 5.1.2600 Service Pack 3)
. 2011-08-06 05:26:45.734 Configuration: HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\
. 2011-08-06 05:26:45.734 Login time: Saturday, August 06, 2011 5:26:45 AM
. 2011-08-06 05:26:45.734 --------------------------------------------------------------------------
. 2011-08-06 05:26:45.734 Session name: USER@DOMAIN.ca (Stored session)
. 2011-08-06 05:26:45.734 Host name: DOMAIN.ca (Port: 21)
. 2011-08-06 05:26:45.734 User name: DOMAIN (Password: Yes, Key file: No)
. 2011-08-06 05:26:45.750 Tunnel: No
. 2011-08-06 05:26:45.750 Transfer Protocol: FTP
. 2011-08-06 05:26:45.750 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2011-08-06 05:26:45.750 Proxy: none
. 2011-08-06 05:26:45.750 FTP: FTPS: None; Passive: Yes [Force IP: No]
. 2011-08-06 05:26:45.750 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2011-08-06 05:26:45.750 Cache directory changes: Yes, Permanent: Yes
. 2011-08-06 05:26:45.750 DST mode: 1
. 2011-08-06 05:26:45.750 --------------------------------------------------------------------------
. 2011-08-06 05:26:45.750 Connecting to DOMAIN.ca ...
. 2011-08-06 05:26:45.765 Connected with DOMAIN.ca. Waiting for welcome message...
< 2011-08-06 05:26:45.859 220 64.14.78.41 FTP server ready
> 2011-08-06 05:26:45.859 USER DOMAIN
< 2011-08-06 05:26:45.906 331 Password required for DOMAIN
> 2011-08-06 05:26:45.906 PASS *********
< 2011-08-06 05:26:46.000 230 User DOMAIN logged in
> 2011-08-06 05:26:46.000 SYST
< 2011-08-06 05:26:46.062 215 UNIX Type: L8
> 2011-08-06 05:26:46.062 FEAT
< 2011-08-06 05:26:46.125 211-Features:
< 2011-08-06 05:26:46.125 LANG bg-BG;fr-FR;ko-KR;en-US*;ja-JP;zh-CN;zh-TW
< 2011-08-06 05:26:46.125 MDTM
< 2011-08-06 05:26:46.125 MFMT
< 2011-08-06 05:26:46.125 TVFS
< 2011-08-06 05:26:46.125 AUTH TLS
< 2011-08-06 05:26:46.125 UTF8
< 2011-08-06 05:26:46.125 MFF modify;UNIX.group;UNIX.mode;
< 2011-08-06 05:26:46.125 MLST modify*;perm*;size*;type*;unique*;UNIX.group*;UNIX.mode*;UNIX.owner*;
< 2011-08-06 05:26:46.125 PBSZ
< 2011-08-06 05:26:46.125 PROT
< 2011-08-06 05:26:46.125 REST STREAM
< 2011-08-06 05:26:46.125 SIZE
< 2011-08-06 05:26:46.125 211 End
> 2011-08-06 05:26:46.125 OPTS UTF8 ON
< 2011-08-06 05:26:46.171 200 UTF8 set to on
. 2011-08-06 05:26:46.171 Connected
. 2011-08-06 05:26:46.171 --------------------------------------------------------------------------
. 2011-08-06 05:26:46.171 Using FTP protocol.
. 2011-08-06 05:26:46.171 Doing startup conversation with host.
> 2011-08-06 05:26:46.171 PWD
< 2011-08-06 05:26:46.250 257 "/www/www" is the current directory
. 2011-08-06 05:26:46.250 Getting current directory name.
. 2011-08-06 05:26:46.250 Startup conversation with host finished.
< 2011-08-06 05:26:46.250 Script: Active session: [1] USER@DOMAIN.ca
> 2011-08-06 05:27:04.484 Script: keepuptodate -delete "D:\NAME's Documents\My Projects\PROJECT\Project" "/www/PROJECT"
< 2011-08-06 05:27:04.484 Script: Watching for changes, press Ctrl-C to abort...
. 2011-08-06 05:27:11.843 Collecting synchronization list for local directory 'D:\NAME's Documents\My Projects\PROJECT\Project\' and remote directory '/www/PROJECT/', mode = 0, params = 187
. 2011-08-06 05:27:11.843 Retrieving directory listing...
> 2011-08-06 05:27:11.843 CWD /www/PROJECT/
< 2011-08-06 05:27:11.890 250 CWD command successful
> 2011-08-06 05:27:11.890 PWD
< 2011-08-06 05:27:11.921 257 "/www/PROJECT" is the current directory
> 2011-08-06 05:27:11.921 TYPE A
< 2011-08-06 05:27:11.968 200 Type set to A
> 2011-08-06 05:27:11.968 PASV
< 2011-08-06 05:27:12.015 227 Entering Passive Mode (64,14,78,41,162,175).
> 2011-08-06 05:27:12.015 LIST -a
< 2011-08-06 05:27:12.109 150 Opening ASCII mode data connection for file list
< 2011-08-06 05:27:12.156 226 Transfer complete
. 2011-08-06 05:27:12.156 Directory listing successful
. 2011-08-06 05:27:12.156 Synchronizing local directory 'D:\NAME's Documents\My Projects\PROJECT\Project\' with remote directory '/www/PROJECT/', params = 187
. 2011-08-06 05:27:12.156 Copying 1 files/directories to remote directory "/www/PROJECT/"
. 2011-08-06 05:27:12.156 PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 01; Resume: S (102400); CalcS: No; Mask: *.*
. 2011-08-06 05:27:12.156 TM: M; ClAr: No; CPS: 0; ExclM(No):
. 2011-08-06 05:27:12.156 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2011-08-06 05:27:12.171 File: "D:\NAME's Documents\My Projects\PROJECT\Project\New Folder"
< 2011-08-06 05:27:12.171 Script: Local 'D:\NAME's Documents\My Projects\PROJECT\Project' => Remote '/www/PROJECT'
. 2011-08-06 05:27:12.171 Creating directory "/www/PROJECT/New Folder/".
> 2011-08-06 05:27:12.171 CWD /www/PROJECT/
< 2011-08-06 05:27:12.234 250 CWD command successful
> 2011-08-06 05:27:12.234 MKD New Folder
< 2011-08-06 05:27:12.281 257 "/www/PROJECT/New Folder" - Directory successfully created
. 2011-08-06 05:27:18.296 Collecting synchronization list for local directory 'D:\NAME's Documents\My Projects\PROJECT\Project\New Folder\' and remote directory '/www/PROJECT/New Folder/', mode = 0, params = 187
> 2011-08-06 05:27:39.718 Script: exit
. 2011-08-06 05:27:39.718 Disconnected from server


(Note: I've redacted any personally identifiable information with NAME, DOMAIN, and PROJECT, but everything else is verbatim.)

Using WinSCP 4.3.4 (Build 1428) on Windows XP SP3.