Solved

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

Posted on 2013-10-26
7
351 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This article describes how to set permissions to allow a limited-permissions user to start and stop a particular System Service.   It is always best to give users only the permissions that they need to perform their job, so tweaking particular permi…
The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
The viewer will learn how to count occurrences of each item in an array.

758 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

21 Experts available now in Live!

Get 1:1 Help Now