Solved

how to retain directory timestamp when copying between drives

Posted on 2011-03-09
4
3,048 Views
Last Modified: 2012-05-11
Hi
I am trying to make a copy of the files/folders on one drive to a folder in another drive (backup). I am wanting to keep everything as is is in the source, so attributes/timestamp etc for files and folders.
I have tried copy, xcopy and robocopy. I can get xcopy and robocopy to retails the file attributes/timestamp, but the folders in the destination end up with the current days timestamp, not its original. I am using the /DCOPY:T in Robocopy, but reading around it seems the drive to drive copy is causing the issue. Is there any (free/easy) way to regularly copy drive (just modified items) to a folder on another drive.
I am using Win7 Pro x64, NTFS on all drives, robocopy version XP027.
cheers
0
Comment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 39

Expert Comment

by:Aaron Tomosky
ID: 35090734
This is a fun one. Xxcopy wil do it but it's not free. I think Syncback keeps folder timestamps.
0
 
LVL 6

Expert Comment

by:mrcannon
ID: 35090744
I believe robocopy with the /COPYALL or the /copy:T  switch is what you need.



http://ss64.com/nt/robocopy.html
0
 
LVL 11

Accepted Solution

by:
Plantwiz earned 250 total points
ID: 35090753
You may want to review this thread:
http://www.technologyquestions.com/technology/windows-xp/191876-robocopy-command-directory-time-stamp-copy.html

It appears that robocopy will not preserve the date stamp
of a folder. However, you do the following:
1. Use robocopy to copy a folder, complete with subfolders.
2. Compile a list of all folder dates.
3. Use a "touch" utility to apply the folder dates to the target folder.

The batch file below will do just that. It makes use of
DirDate.exe, which you can download from
http://www.datamystic.com/buy/dirdate.html.
DirDate is not free but you might find other touch tools that are.

The batch file relies on drive T: not being used for anything
else. You must remove all # characters - they only serve to
mark the beginning of each line. Do not retype the file - use
copy & paste instead.

#@echo off
#set first=true
#set DDate=zzz
#set Source=d:\temp
#set Target=d:\New
#set TempFile=d:\dir.tmp
#set TouchTool=C:\Program Files\DataMystic\DirDate\dirDate.exe
#if exist d:\Touch.bat del d:\Touch.bat
#
#robocopy "%Source%" "%Target%" *.* /s
#
#subst T: "%Source%"
#dir T:\ /s /ad /tw | findstr "Directory .." > "%TempFile%"
#for /F "delims=" %%a in ('type "%TempFile%"') do call :Sub %%a
#subst T: /d
#
#subst T: "%Target%"
#call d:\Touch.bat
#subst T: /d
#
#goto :eof
#
#=============================
#:Sub
#set parms=%*
#if %parms:~0,3%==Dir set Dir=%parms:~13%
#if not %parms:~0,3%==Dir set DDate=%parms:~0,10%
#if not %DDate%==zzz (
# if not %first%==true echo "%TouchTool%" Date=%DDate% "%Dir%" >>
d:\Touch.bat
# set first=false
# set DDate=zzz
#)




And if you are inclined to use a different tool:
http://lifeonubuntu.com/keep-existing-file-attributes-during-copy/
0
 
LVL 6

Expert Comment

by:mrcannon
ID: 35090772
Sorry AotearoaPeoplesNetwork I just realized I did not read your question fully and you were already at Robocopy.  Plantwiz's find looks promising though.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

688 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