TechHead

Virtualization blog also covering Cloud, Windows & Tech how-to

  • Home
  • Blog Categories
    • VMware
      • VMware “How To” Posts
      • VMware Troubleshooting
      • VMware Workstation & Fusion
      • VMware Backup & Replication
      • VMware vCloud Director
      • VMware Certification
      • VMware Horizon
      • VMware PowerCLI
      • VMware Security
      • VMware Training
      • VMware User Group & Community
      • VMware View
      • VMworld
      • VMware Useful Links
    • EMC
      • Virtual Storage Appliance (VSA)
      • vSphere VSI Plugin
    • HP
      • Proliant Servers
    • Microsoft
      • MS Windows Server
      • MS Hyper-V
      • MS Exchange
      • MS SQL Server
      • MS PowerShell
    • General Tech
    • Cloud
    • Networking
    • Iomega
    • Apple
    • Cisco
    • Linux
    • Internet & Web
    • WordPress
  • About Me
  • Home Labs
  • VMware Tools
  • Crypto Links
  • Cool Tech Links
  • Recommended Podcasts
    • vChat Podcast Episodes
You are here: Home / General / How to copy or move files and folders whilst maintaining their original time date stamp.

How to copy or move files and folders whilst maintaining their original time date stamp.

1 July 2009 by Simon Seagrave 26 Comments

It’s often useful when try to replicate live file data to maintain the date/time stamp of the data you are copying or moving.  As you no doubt know a standard copy whether it be from the command line or by a simple drag and drop will give any copied/moved files a new date/time stamp of the current time.

A simple way of maintaining the original date/time stamp of a file or folder is by using the ever useful  Microsoft RoboCopy utility.  This is built into Windows Server 2008, Vista and Windows 7 as standard though if you are running an earlier Windows OS (eg: XP or Windows Server 2003) it can be found, and used, as part of the Windows Server 2003 Resource Toolkit which can be downloaded from here. 

However I should point out that the useful ‘DCOPY’ command which maintains the date/timestamp of the directories is only available with the versions of Robocopy found after that in the Windows Server 2003 Resource Toolkit (ie: > XP010).

For the ‘DCOPY’ command you will require the XP026 version of Robocopy which can only be found in a Microsoft Utility called ‘Utility Spotlight’ which provides a GUI front-end to Robocopy and can be downloaded via a link at the top of this page.  Don’t worry as you don’t have to use the GUI interface.

Also if you’re running Windows Server 2003 then you’ll find that the Vista and Windows Server 2008 versions won’t run if you copy and then attempt to run this version of robocopy.exe locally.

If you’ve already downloaded and installed the Windows Server 2003 Resource ToolKit and then Utility Spotlight (GUI Robocopy) you will find that you’ll still get the XP010 version of Robocopy when running it from the command-line.

The reason?  The Utility Spotlight installation copies the updated (ie: XP026) version of Robocopy to the C:WindowsSystem32 directory as opposed to the version found in the ‘Resource Toolkit’ directory on the C drive.  When Robocopy is run from the command-line it uses the version (ie: XP010) found in the ‘Resource Toolkit’ directory.

To resolve…  delete the version of Robocopy found in the ‘Resource Toolkit’ found on the C drive.  When you go to run Robocopy from the command-line again it’ll use the more recent version found in C:WindowsSystem32.

Here is a summary of the different versions:

  • XP010 – Bundled in the Windows 2003 resource kit
  • XP026 – Downloaded with Robocopy GUI
  • XP027 – Bundled with Windows Vista
  • XP028 – Bundled with Windows Vista SP1 and Windows Server 2008

Below is an example of the Robocopy syntax that you’d use to maintain the date/time stamp on both the files and directories during a copy:

How to copy or move files and folders whilst maintaining their original time date stamp

For a good explanation of all the Robocopy commands checkout this Wikipedia entry.

 

Technorati Tags: Microsoft,Robocopy,copy,move,maintain,time,date,stamp,folder,directory

Filed Under: General

About Simon Seagrave

Simon is a UK based Virtualization, Cloud & IT Technology Evangelist working as a Senior Technology Consultant and vSpecialist for EMC. He loves working in the ever changing IT industry & spends most of his time working with Virtualization, Cloud & other Enterprise IT based technologies, in particular VMware, EMC and HP products.

As well as on this site, you can find him on Twitter and Google+

Comments

  1. octavius says

    15 July 2009 at 5:55 pm

    WOW!! This is great. It makes a real difference when doing large file copies. Cheers!

    Reply
  2. Chin says

    1 September 2010 at 2:15 pm

    I’ve been look this kind utility for a while. This is great explanation….Very clear and all steps. You save my work a lot easier. Thank you so much.

    Reply
  3. Neil says

    27 October 2011 at 4:31 pm

    I tried it and it doesn’t copy a newer version of robocopy.exe to system32
    Also the gui options do not include dcopy

    Reply
  4. Villy says

    5 January 2012 at 5:13 pm

    only wish I have read the whole articel and not only the first part. used 4 hours to no use and only my self to blame 🙂
    now dcopy:t works as expected.
    thank you for your effort.

    Reply
  5. Marvin says

    17 March 2012 at 1:04 am

    Simon–Agreed, very clear explanation. Thank you!

    Neil, you didn’t read carefully. The GUI version does NOT go to the system32 folder so don’t look for it there! And although it is true that the GUI options don’t include DCOPY, you are not limited to the GUI. You run the GUI version via your command prompt. (In XP click “Run” on the start menu, then type in “cmd”. Then type in your robocopy copy command, which can, in fact, include DCOPY.) Works like a charm! If you need help with command prompt syntax, there’s plenty out there on the web.

    Reply
  6. Dennis Black says

    27 March 2012 at 10:36 pm

    Just an FYI for those that stumble upon this having trouble with /DCOPY:T command in Robocopy.

    I kept trying to use this command and it was not working when trying to use the /DCOPY:T command. My timestamps on my files were fine, but the timestamps on the directories were the current file copy timestamp.

    After breaking down each command 1 by 1 I realized that the /MT command for multi-threading causes the /DCOPY:T to no longer work correctly. I was using Robocopy on our Windows 2008 R2 file server to initiate the copy from our remote file server.

    If you would like to test this, use the /CREATE command to generate the files and directories with ZERO data so that it executes quickly for testing.

    Reply
  7. Don says

    9 April 2012 at 8:17 am

    I believe your original premise is incorrect.
    Copying a file from one local drive to another local drive i.e. partitions on a single physical drive does not alter the timestamp.
    Copying to a Networked Drive does, unless my system is up the creek, but I just tested that.

    Reply
  8. john says

    25 June 2012 at 6:26 pm

    Hi. If you are running 64bit version of windows 2003 server, the command line version it will NOT install in system32, but rather, the WINDOWSWoW64 directory. This drove me nuts, but finally found it and it works.

    Reply
  9. Bryan says

    27 June 2012 at 9:07 pm

    Hi,

    How do I use the Robocopy /Move command and preserve the folder dates? It’s assigning the current date and time to the folders it moves. I’ve tried this way:

    /S /MOVE /R:3 /W:5 /REG /FP /NFL

    and this way:

    /S /COPY:DATSO /DCOPY:T /MOVE /R:3 /W:5 /REG /FP /NFL

    Both with same result, new folder dates.

    Thanks,

    Bryan

    Reply
  10. TechGuru says

    28 August 2012 at 6:30 pm

    Now copy data or move files with original date and time with a small software

    http://www.technocomsolutions.com/data-copy-tool.html

    Reply
  11. Davidus428 says

    14 October 2012 at 2:55 pm

    It’s simple to move folders and directories and still preserving Creation Date. Just hold “shift” and drag the folder to the new location (move command). Date Modified will be the present date but Date Created will retain the original date. hope this helps.

    Reply
    • Simon Seagrave (TechHead) says

      31 October 2012 at 8:20 am

      Good tip – thanks.

      Reply
  12. germangelv says

    19 November 2012 at 7:00 pm

    Upload rebocopy.exe !!!! XP028

    Reply
  13. Mital says

    11 December 2012 at 12:06 pm

    Thanks very much, this was very useful on directory timestamps.

    Reply
  14. Geoff says

    14 May 2013 at 12:12 am

    Cheers for this explanation, very helpful

    Reply
  15. bacosystem1 says

    12 June 2013 at 8:59 am

    Hi,
    How could i move files and folders which is in “Work1” folder, to “Work2” folder along with folder structure by checking the “last-modified-date”. It should scan whole files and foldres in Work1 and should move automatically the file folders to Work2 if the file folders date is 45 days older than current date.

    Please help me for this. I got more than 50K files in my Work1 folder, out of that 25% files are working presently. I dont want to delete old files, i’ll keep it as backup.

    Reply
  16. David Spector says

    16 July 2015 at 12:38 pm

    Many times during my 40 year career as a software engineer I ran into operating systems that routinely updated the date-time-modified of files whenever they are copied. I always told the OS designers in my companies that DTMs should reflect the time when the user modifies a file by using a modification program such as a file editor, or when the user first generates the file. DTMs should always be preserved by OS copying, no matter what the context or reason for the copying, because it is most useful as an attribute of the content, not of the file proper (the file as a container).

    It was like talking to a wall. Not one OS designer seemed to understand the value of preserving DTMs as reflecting user modifications rather than strict file modifications. Their view of files as simple containers hid their understanding of how users view files: as containing data that they can modify.

    Maybe this note will be discovered someday by the designers of Windows 100 and finally provoke change.

    System: Firefox 39.0 under Windows 8 on Asus Laptop

    David Spector
    Springtime Software

    Reply
  17. Satya says

    20 January 2016 at 2:45 am

    Awesome. Thanks for your help

    Reply
  18. James says

    29 January 2016 at 9:51 pm

    I need to copy/paste excel, word, and jpg files from my backup DVD to the C drive in this new Windows 10 computer with Office 2016. It MUST RETAIN the original “created” and “Modified” dates. How can I do this?

    Reply
  19. Simon Carter says

    4 May 2016 at 4:03 am

    If you find that RoboCopy has not copied the file or folder create/modified dates, then try the useful little utility called DirDate – http://www.datamystic.com/dirdate.html

    Reply
  20. vinijames says

    3 August 2016 at 12:37 pm

    http://www.lantechsoft.com/data-copy.html
    Try this tool .
    It Keeps same Date-Time of folders and files when moving or copying data

    Reply
  21. Sophia Joseph says

    24 June 2017 at 9:36 pm

    To preserve date time stamps, to pre schedule my file transfers, for email notification when the transfer is complete and many exciting and new features I’m using GS Richcopy 360. I would suggest everyone to try it. I am using it on Windows 10 and have also used on win 8. It is compatible for every version of windows now. Some of its remarkable features are, it provides multi threaded file transfer, file compression before copying, NTFS support and many more. Try it, maybe it can help you too!

    Reply
  22. vikas khandola says

    14 February 2018 at 4:06 pm

    use robocopy

    Reply
  23. Subbu says

    4 September 2018 at 11:28 pm

    Thanks, this worked for me.

    Reply
  24. Robert Baker says

    25 May 2019 at 7:55 am

    Very useful information! ROBOCOPY is truly the future of file-system enforcement. 😉

    One thing though: you have to run it in admin mode, or it won’t work.

    Reply
  25. Robert Baker says

    27 May 2019 at 9:39 am

    I have also found that I need the additional parameters:

    /XF *.sys — don’t (attempt to) copy any system files. Setting an exclude list, if needed, is important because by default ROBOCOPY tries to copy each file up to a million times, pausing for 30 seconds between each attempt — if it runs to the full million, that’s nearly a year.

    To prevent the above, the first time you use ROBOCOPY use:

    /R:n — limit number of retries to n.
    /W:n — wait n seconds between retries
    /REG — save the R and W values to the registry, so in future you don’t need to specify them.

    I use /R:10 /W:5.

    Reply

Leave a Reply to vinijames Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Looking For Something?

Site Sponsors

Click here to become a sponsor

Awards

VMware vExpert

About Me

Simon Seagrave - TechHead - VMware EMC HP IT Tech Blogger My name is Simon Seagrave and I am a Massachusetts (ex UK) based Technical Marketing Consultant working for Dell EMC. I love my work & spend most of my time working with Virtualisation & other Enterprise IT based technologies, in particular VMware, EMC and Dell products. I am a VMware vExpert (2009 - Present).

Recent Post Comments

  • Michael on [Fix] How to access Starbucks WiFi when you aren’t redirected to the login page
  • Michal on "Cannot change the host configuration" error message when adding disk storage to a VMware vSphere ESXi Host
  • Jorge on Email Fail – virtual_aliases via virtual_aliases router force address failure
  • Javier on Email Fail – virtual_aliases via virtual_aliases router force address failure
  • Robert Baker on How to copy or move files and folders whilst maintaining their original time date stamp.

Recent Posts

  • [Fix] How to access Starbucks WiFi when you aren’t redirected to the login page
  • Fully Featured VMware vSphere Web Client (finally) On The Way
  • [Podcast] vChat Episode 45–Things Crypto-Currency and Crypto-Mining
  • [Link] Dell EMC Interactive Demos
  • "Cannot change the host configuration" error message when adding disk storage to a VMware vSphere ESXi Host

EZ Fat Footer #1

This is Dynamik Widget Area. You can add content to this area by going to Appearance > Widgets in your WordPress Dashboard and adding new widgets to this area.

EZ Fat Footer #2

This is Dynamik Widget Area. You can add content to this area by going to Appearance > Widgets in your WordPress Dashboard and adding new widgets to this area.

Copyright © 2019 · Dynamik-Gen on Genesis Framework · WordPress · Log in