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?


Robocopy. Has options to copy various attributes including timestamps


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

   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)

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


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));

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy