Solved

how to retain directory timestamp when copying between drives

Posted on 2011-03-09
4
3,024 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

732 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