8

I asked this on stackoverflow... but I think I should be asking it here: Is it possible to copy a file or a folder from one location to another without modifying its attribute data?

For example if I have a folder on a network drive and it was created on 2/3/2007 and I want to copy it to my c: drive .. but leave the date/time stamp as 2/3/2007...is that possible?

4 Answers 4

7

Robocopy. Has options to copy various attributes including timestamps

http://www.ss64.com/nt/robocopy.html

Syntax
      ROBOCOPY source_folder destination_folder [file(s)_to_copy] [options]

Key
   file(s)_to_copy : A list of files or a wildcard.
                          (defaults to copying *.*)

  Source options
                /S : Copy Subfolders
                /E : Copy Subfolders, including Empty Subfolders.
 /COPY:copyflag[s] : What to COPY (default is /COPY:DAT).
                      (copyflags : D=Data, A=Attributes, T=Timestamps).
                      (S=Security=NTFS ACLs, O=Owner info, U=aUditing info).
              /SEC : Copy files with SECurity (equivalent to /COPY:DATS).
          /DCOPY:T : Copy Directory Timestamps. ##
          /COPYALL : Copy ALL file info (equivalent to /COPY:DATSOU).
           /NOCOPY : Copy NO file info (useful with /PURGE)
3

rsync has the option "-t, --times" to preserve times.

0

Seeing as this was also tagged with C#:

You can copy a file and any attributes/timestamps you like along with it:

File.Copy(myFile, myNewFile);
File.SetCreationTime(myNewFile, File.GetCreationTime(myFile));
0

You can use Total Commander (ghishler). In setup utilities, copy, you can set copying folders to copy date and time. It works copying folder for c: to e: but copying for e: to desktop i had a problem.

You must log in to answer this question.