networking - How can I get a file copied from one location to another location on the same server without the echo

23
2014-04
  • Anthony

    Is it possible to copy a file from one location to another location on the same server without the file traveling from the server to the workstation and then back to the server. The scenario is the Microsoft Windows vista Peer to Peer network.

    Thank you.

  • Answers
  • JdeBP

    Obviously, if you are actually logged in and issuing a copy command on the server itself, the copy operation doesn't involve any workstations. ☺ But you seem to be asking about instigating a copy command from a workstation, that copies within a single fileserver and where the whole copy operation is executed by the server itself (subject to the normal access permissions and so forth).

    LAN Manager, LAN Server, and CIFS

    There is no way, now, to do this. There used to be, in the SMB protocol, a command for performing server-side copies, where none of the copied data need travel across the LAN. It was SMB_COM_COPY.

    It was only ever exercised by workstations running OS/2. OS/2 applications have a DosCopy() system API function available to them, and the OS/2 LAN Server network redirector in OS/2 was clever enough to recognize when a file was being copied from a remote network volume to a different place on that volume, and forward the entire operation to the server.

    There's been no real capability for exercising SMB_COM_COPY in workstations running MS-DOS or Windows NT. There's not even a "copy an entire file" system call in the (unextended) MS-DOS API to hook into. As such, Microsoft decided to drop that part of the protocol from NT LAN Manager, and a CIFS transaction with that command ID now simply generates an error response.

    Netware

    There is a way to do this. There is a whole file copy transaction in the Netware protocol, and the Netware network redirector for OS/2 was clever like the LAN Server network redirector. So again, OS/2 workstations would exercise this automatically, as applications called DosCopy() to copy files around.

    As with SMB/CIFS, there was no real way to plumb the Netware mechanism into MS-DOS proper for use by applications in general. However, there are Netware-specific extensions to the MS-DOS API. The Netware Client for MS-DOS thus came with an NCOPY command for MS-DOS, which knew about the API extensions, called them, and thus could perform server-executed copies (that also preserved Netware file attributes).

    There's an ncopy command for Linux that issues the same Netware protocol command. There is — alas! — nothing equivalent for Windows NT, and no way to make use of this facility from a Windows NT workstation.

  • e40

    I assume you are using a bat file script, so it would be like this:

    @echo off
    copy file1 file2
    

    If this doesn't solve your problem, please give more details.

  • Col

    I don't think windows will let you do this. It would involve you invoking the command on the remote server which you might not have the authority to do. In the past for these situations I've generally terminal serviced into the server and done the copy from there.


  • Related Question

    networking - How to automatically move a file to another PC on the network?
  • Keith Donegan

    Here is what I am after.

    I have 2 PCs connected on a network and one of them prints out an excel spreadsheet every night to a specific folder. is it possible to use a batch script to copy that file to the other computer on the network at a certain time?

    Thanks


  • Related Answers
  • Diago

    You can.

    • Create Batch File (Use UNC paths to copy - I recommend RoboCopy)
    • Create Scheduled Task to call batch file at certain time
    robocopy C:\FolderName\ \\machinename\sharedfolder "filename.ext"
    
  • kquinn

    Set up a scheduled task to run a program/batch file that executes a copy command.

    A batch file to do that might look like

    COPY \\server-name\path\to\file.dat C:\directory\new-location\
    
  • Pauk

    An alternative to a batch file / Windows scheduled task, is to use SyncBack (freeware) where you can create a profile to copy your Excel spreadsheet from the source machine to the target at a specific time.

  • Artur Carvalho

    You can save this in a .bat file. After that you can schedule it.

    :: This is the backup 
    
    
    set SourceDir=F:\XXX
    set DestinyDir=I:\YYY
    
    
    xcopy /e /v /y /I %SourceDir% %DestinyDir%
    

    I never tested the time it takes, but it seems that xcopy is faster than the regular copy. Look what the commands do here.

  • quickcel

    Another option is to use the Windows SyncToy 2.0 utility and then set a scheduled task along with it.