Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to retain directory timestamp when copying between drives

Posted on 2011-03-09
4
Medium Priority
?
3,175 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 1000 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

604 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