locked
How to copy a file ? RRS feed

  • Question

  • Hi,

    I have windows 7 machine and want to write a batch file to copy one single file from source to destination folder but with a different name. Source and destination are different computers on the network. Can somebody give me the script to do that ? Also, what should be used : Robocopy or XCOPY ?


    Kulvinder Singh

    Thursday, October 4, 2012 11:27 AM

Answers

  • When i do the copy, the file created has the same creation date as the source file. How do i get a new creation date ?

    Kulvinder Singh

    This is the way the "copy" commands are designed to work: They create an exact copy of the source file. If you wish to change the file's date stamp then you can use one of the many "touch" tools, e.g. this one: http://pobox.com/~stevemil
    • Marked as answer by Leo Huang Thursday, October 18, 2012 8:41 AM
    Thursday, October 11, 2012 1:23 PM

All replies

  • Hi. If you have access to both servers, you can use this direct command:

    echo f | xcopy \\server1\share\file1.dat  \\server2\share\file2.dat

    Xcopy asks, if file2.dat is file or directory. That's why there is "echo f" :)

    M.


    • Edited by MStoppl Thursday, October 4, 2012 2:05 PM
    • Proposed as answer by MStoppl Thursday, October 4, 2012 6:41 PM
    Thursday, October 4, 2012 2:05 PM
  • When i do the copy, the file created has the same creation date as the source file. How do i get a new creation date ?

    Kulvinder Singh

    Thursday, October 11, 2012 11:19 AM
  • When i do the copy, the file created has the same creation date as the source file. How do i get a new creation date ?

    Kulvinder Singh

    This is the way the "copy" commands are designed to work: They create an exact copy of the source file. If you wish to change the file's date stamp then you can use one of the many "touch" tools, e.g. this one: http://pobox.com/~stevemil
    • Marked as answer by Leo Huang Thursday, October 18, 2012 8:41 AM
    Thursday, October 11, 2012 1:23 PM