Solved

xcopy alters the creation date of destination files copied but not 'copy'

Posted on 2013-10-26
7
354 Views
Last Modified: 2013-10-29
When i used xcopy to copy files from one PC to another PC's
drive (which is mapped by the current PC), the destination
files/folders created will take the date stamp of the date
that this xcopy command is being done.

Windows command prompt's  "copy" command will retain
the date of the original source's files but I have lots of
subdirectories so 'copy' command is not practical.

What other ways I can do to do the subdir copying that
retains the source files/folder's date/time stamp?

if there's no other suggestions, I'll test out Windows Explorer
later
0
Comment
Question by:sunhux
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 13

Assisted Solution

by:Daniel Helgenberger
Daniel Helgenberger earned 78 total points
ID: 39602553
Consider using robocopy, MS's try to mimic rsync. Build in, fairly powerful:
robocopy /mir <source> <dest>

Open in new window

http://technet.microsoft.com/en-us/library/cc733145(v=ws.10).aspx
0
 
LVL 18

Assisted Solution

by:Steven Harris
Steven Harris earned 196 total points
ID: 39602560
+1 for robocopy

Robocopy <source> <destination> /mir /dcopy:t /L

/mir is for mirroring
/dcopt:t preserves timestamps

/L will list the actions so you can verify that it will run correctly.

Remove /L to do the actual copy.
0
 

Author Comment

by:sunhux
ID: 39602875
Thanks, managed to get a copy of Robocopy.


Just one last question:

What if I want Robocopy operation such that if Robocopy
detects that the destination file is newer, it will not over-write
(& not delete) the destination file/folder.  What qualifier to use?
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:sunhux
ID: 39602881
And one last query:
does /mir  only do the 'differential' copy ie if the
destination has a file of the same date, it will not
copy/overwrite.  In this way copying of the tens of
thousands of files can be completed faster
0
 
LVL 28

Assisted Solution

by:Bill Bach
Bill Bach earned 116 total points
ID: 39602915
I agree that RoboCopy is likely one of the best options.  However, sometimes you want to be able to "see" what is going on, or to have more specific control over the process.  Check out the Beyond Compare utility (www.beyondcompare.com) and see if it works for you.  It supports command-line execution, handles mirroring very easily, is SUPER-FAST, and (unlike RoboCopy) has a complete GUI interface that you can use, too.  

This GUI makes it a lot easier to see exactly what will be copied (and what won't).  Personally, I found this tool years ago and continue to use this tool for my development folders.  When I develop on one machine and need to transfer back to the server (or to my laptop when traveling), I can bring up both directory lists side-by-side, sync data in one direcvtion (or both), and know that I have full control over the process because I tell it which files to copy from the GUI interface.  

Of course, I also use the same tool for automated backups -- scheduling the command-line script on a Windows server and running it every day to back up critical data to a NAS and then later to an external USB HDD.
0
 
LVL 18

Accepted Solution

by:
Steven Harris earned 196 total points
ID: 39603060
@ sunhux

Thanks, managed to get a copy of Robocopy.

ROBOCOPY is a command line tool, no download needed...

Just one last question:
What if I want Robocopy operation such that if Robocopy
detects that the destination file is newer, it will not over-write
(& not delete) the destination file/folder.  What qualifier to use?

you are looking for the /XO syntax.

/XO - if destination file exists and is the same date or newer than the source - don’t bother to overwrite it.

Visit SS64.com for a full listing of ROBOCOPY commands.  There are so many variations you can create, the possibilities are almost endless.

ROBOCOPY
0
 
LVL 28

Assisted Solution

by:Bill Bach
Bill Bach earned 116 total points
ID: 39603390
Not germaine to the thread -- but Robocopy is only included as part of Vista and 2008 Server (and newer).  Users of Windows XP and Server 2003 would need to go out & find a download.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Log files are useful in diagnosing and repairing problems.  This is a list of common log files and their standard locations that I've compiled.   While this is not exhaustive, it is a pretty good list that I've found to be useful.  I may update it f…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now