1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

copy ftp: with /w problem

Discussion in 'Support' started by kafka, Nov 11, 2009.

  1. kafka

    Joined:
    May 30, 2008
    Messages:
    2
    Likes Received:
    0
    I seem to have discovered a problem with the copy /w switch when the source is an ftp: path. I am trying to synchronize a local copy of a directory structure from a Western Digital NAS (ShareSpace model WDA4NC2000). Up until version 11 came out I used a command like:
    copy ftp:/MSCR Y:\MSCR\Current\MSCR /u/s/ne
    This worked fine (and still does with version 11) except it doesn't delete any files in the local copy (Y:) that no long exist on the NAS. When version 11 came out I added the /w switch, like:
    copy ftp:/MSCR Y:\MSCR\Current\MSCR /u/w/s/ne
    This command now deletes any local files (Y:) that were deleted on the NAS which is what I expected.

    The problem is that the copy command initially deletes all of the files in the Y:\MSCR\Current\MSCR directory and then copies all of the files in the ftp:/MSCR directory to the Y:\MSCR\Current\MSCR directory. It also does this from some of the sub-directories (but not all of them).

    If I remove the /w switch from the copy command, only the changed files will be copied, which most of the time is none of the files. I also discovered while trying to understand the problem, if I perform a "cd ftp:/MSCR" before performing the copy command, it works correctly (i.e. only coping changed files and deleting missing files).

    The other issue is that the /w switch seems to cause the copy command to take about three times longer to execute when there are no changes (total of 1200 files in 494 directories).
     
  2. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    kafka wrote:
    | copy ftp:/MSCR Y:\MSCR\Current\MSCR /u/s/ne

    Unfortunately that's incorrect syntax - options that apply to all parameters
    are supposed to be before the first parameter (the source file or directory
    for COPY) is specified. I am not sure if any other command besides COPY
    deals with options (other than /A and /B for COPY) which apply only to
    parameters that follow the option, but not to all parameters. The TCC parser
    is almost, but not quite DWIM, so it usually accepts incorrect order of
    command elements, but not always. BTW, is your COPY command actually an
    alias?

    Sorry, but I have not had a chance to investigate the problem itself you
    reported.
    --
    Steve
     
  3. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,854
    Likes Received:
    83
    WAD. /W is *not* an add-on to /U, and is not intended for updating, just
    (occasional) syncing.

    Before it does a copy, it will first search the target directory, and for
    every file it will search the source directory for a match. If it doesn't
    find one, it will delete the file in the target directory.


    See above.

    Rex Conn
    JP Software
     
  4. kafka

    Joined:
    May 30, 2008
    Messages:
    2
    Likes Received:
    0
    I expect and want it to delete files from the target that don't exist on the source. The help does not indicate that /u and /w are exclusive, nor do their descriptions conflict. I want to "Copy each source file only if it is newer than a matching destination file or if a matching destination file does not exist" and to "Delete files in the target directory that don't exist in the source directory". In other words, I want C:/XYZZY to be a mirror of ftp:/XYZZY.

    If you execute the following three commands, what should the second and third commands do?

    copy ftp:/XYZZY C:\XYZZY
    copy /u ftp:/XYZZY C:\XYZZY
    copy /u/w ftp:/XYZZY C:\XYZZY

    I would expect the second and third commands to only compare file information and not actually modify the target. I expect both the second and third commands to do the same thing (assuming nothing has changed in either the source or the target).

    What I am seeing the third command do depends upon what the current directory of the source (ftp:) is.

    If the current directory of the source is (ftp:/), the third command deletes all of the files in the target (C:/XYZZY) and then copies all of the files from the source to the target.

    If the current directory of the source is (ftp:/XYZZY), the third command works identically to the second command (except for taking longer to execute).

    This is the first time I can remember a command depending upon what the current directory is of a source when using an absolute path for the source.

     
  5. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,854
    Likes Received:
    83
    Not reproducible here. COPY (and TCC) don't care about the current
    directory of the source.

    The only thing I can think of is that your FTP server is refusing to return
    the file info when in the root. (Do you actually have root access? Do you
    mean the *real* root, or the default home directory?) TCC queries the
    server to see if the file exists on the server; if the server says "no",
    then the local copy gets deleted.

    Rex Conn
    JP Software
     

Share This Page