Solved

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

Posted on 2013-10-26
7
355 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

Title # Comments Views Activity
Ready Made PHP Scripts 5 70
create an incrementing variable name AutoHotKey 5 98
Automating a script for user accounts LINUX 14 73
Sums of coloumns in html/java 15 76
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…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
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…
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…

773 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