locked
How to maintain Folder attributes (date created/modified) on a 'Copy' - when a new file is added RRS feed

  • Question

  • Hi

    Apologies for the title - I tried to encompass my problem.

    Basically, it's this:

    I have a drive that I need to copy all the data from and move to a larger drive (1TB DAS moved to a 6TB NAS device). I need to preserve the folder's date created and (if possible) modified attributes, as the data being copied is a WIP folder for a big CGI project, and it's important to be able to track and find specific info/folders via date created... essentially the job is ongoing for another 6/7 months.

    So, normal copy/paste won't do... thanks to this forum :) I've used Xcopy and worked out how to migrate the data and keep the all the new/copy folder's date created and modified attributes in line with the original/source. 

    Meaning I can make a perfect copy with folder dates that match.

    However (and this is where I am head scratching), as soon as any new data is added into the copy folder, it's attributes change... not only the folder's modified date (which I was expecting) but also the date created folder.

    This is a problem as the folders will have new data added to them on an ongoing basis... but, as both modified and created dates change to the time the new file is added, it causes issues when finding specific nested folders via creation date.

    Example: Copy folder (done today via Xcopy) shows creation and modified date as per the source of 11/12/2012. As soon as any file is added into that folder, it updates modified and creation to the time the file was written to the folder (ie XXtime 06/09/2013).

    I presume this is Windows file system based... but I can't be the only one to have seen/experienced this so I'm wondering if there is anything I'm missing or something that I can do (at least) to preserve the creation date of the folder when adding new data within it?

    Thanks.



    Friday, September 6, 2013 11:07 AM

Answers


  • BTW - with the Xcopy, it was a 2 stage process. /s/e/k first then a copy over but using /d/t/e/k. Copying in the first pass and then overwriting the folders in the second pass (with the correct creation date).

    Thanks for the Robocopy/mir tip... that will work for bulk copying the data... sadly, when it's on the NAS, any additions to the folder change the creation date. Pretty sure it's the NAS file system (or lack of compatibility).

    Going to test some spurious data using some other DAS drives - as I think it's the NAS (as per Lacie's reply).

    Now I need to find a NAS that'll handle NTFS.

    But at least I feel I'm getting somewhere now - thanks :)

    Andy
    • Edited by Andy_White_101 Thursday, September 12, 2013 6:51 PM
    • Marked as answer by Cloud_TS Monday, September 16, 2013 2:39 PM
    Thursday, September 12, 2013 6:22 PM

All replies

  • You can use robocop it keeps your source date/time and you can keep links and attributes and ACLs (security).

    Also you can also use the /MIR command to mirror a directory structure completely

    More info on the robocopy command is found here:

    http://technet.microsoft.com/en-us/library/cc733145%28v=ws.10%29.aspx


    Don't forget about Alt+Esc!

    Friday, September 6, 2013 12:03 PM
  • You can use robocop it keeps your source date/time and you can keep links and attributes and ACLs (security).

    Also you can also use the /MIR command to mirror a directory structure completely

    More info on the robocopy command is found here:



    Don't forget about Alt+Esc!

    Thanks for the quick reply!

    I'll try doing a test with Robocopy... but the method I'm using for Xcopy works perfectly (full copy of the nested folders, all data, and all folders have the 'source' attributes in terms of date created/modified etc).

    The issue comes when I add a 'new' file into one of these folders... the attributes then change to the exact time the new file was added. I need to maintain the folder's date created (as a minimum) even when new data is added into it.

    I suspect Robocopy, as with Xcopy, will make a perfect copy/clone/mirror... but I need to be able to add data within those folders and still maintain the folder's original creation date.

    Thanks again for the quick reply, and I will, of course, test Robocopy next.

    Friday, September 6, 2013 12:15 PM
  • Ah sorry my bad i didn't read your whole post true sorry ;) (one shouldn't post on forums while being on the phone :P)

    Then i'm sorry but it is by design that the folder date changes when you put files/modify anything in the folder. I don't think there is anything you can do.


    Don't forget about Alt+Esc!

    • Marked as answer by Cloud_TS Monday, September 9, 2013 12:16 PM
    • Unmarked as answer by Cloud_TS Monday, September 9, 2013 12:16 PM
    Friday, September 6, 2013 12:25 PM
  • No problem :)

    I was hoping there was something I was missing... but suspected it was windows file system based.

    However, what confuses me is that both the modified and created attributes change when a file is added to the new folder. I'd expect an new file addition inside it to only change the modify date but not change the creation date of the folder too.

    What I suspect is happening is that the copy initially preserves mod/creatd dates until a file is added. Then both mod/created are 'updated' as (somehow) the copy folder knows it wasn't really created on the date it's showing... so, as soon as a file is added, it happily changes itself to match the attributes of the file just added (in terms of mod/creation).

    Just wondering if there's a way around it. I know there's a flag for directory access I could try (NtfsDisableLastAccessUpdate) but I don't really want to do any Registry editing (8 different workstations access the data - a mix of W8, W7 and W7Pro) as that means altering each machine.

    Anything else I'm missing?

    Friday, September 6, 2013 1:25 PM
  • Hi Andy,

    Could you please tell me what are the xcopy command parameters you use to copy these files and folders? 

    Regards,

    Yolanda 

    Tuesday, September 10, 2013 1:16 AM
  • However (and this is where I am head scratching), as soon as any new data is added into the copy folder, it's attributes change... not only the folder's modified date (which I was expecting) but also the date created folder.

    Hi Andy,

         

    I have tried copy and create files into the folder and, in both cases, the folder's Date created is not affected. Only the Date modified is changed. 

        

     

        

    Can you elaborate how you add files to the folder? By means of copy / create / FTP etc?

        

    Cheers,




    • Edited by Tas76 Tuesday, September 10, 2013 4:37 PM
    Tuesday, September 10, 2013 4:32 PM
  • Hi,

    Actually, I also performed a same test as Tas76 did, and got the same result as the screen shot above, thus I’m a little puzzled about the issue Andy mentioned. Am I misunderstanding something?

    Regards,

    Yolanda

    Wednesday, September 11, 2013 1:51 AM
  • Hi Yolanda and Tas76

    Sorry for not getting back sooner, I've been bed-ridden with the flu :(

    Basically, I can get the data over (from the DAS to the NAS), but as soon as I add a file in the NAS (the new home of the copy folder), the date crated date changes (as well as date modified).

    For now, I've been simply testing the process (and had given up - but now have some hope thanks to your tests!), as the actual folder structure and contents I need to move are approx 800GB.

    I used this method:

    xcopy c:\PROGRAM_FILES\faceshift\* "\\Lacie-2big-nas\x\faceshift" s/e/k

    Which copied all the data

    and

    xcopy c:\PROGRAM_FILES\faceshift\* "\\Lacie-2big-nas\h\faceshift" d/t/e/k

    Which then overwrites the folders only (not contents) with the correct datestamps.

    Maybe I'm in error with my Xcopy commands! If so, please correct me and I'll do another test!

    My data folder has many more folders inside... and these are the ones I tested to see if the dates changed (ie h\faceshift\data\wip etc) and when one of these folders was touched (by adding a file), the date modified changed (as expected) and the date created changes (as not expected!).

    Thanks again for your help :)


    Wednesday, September 11, 2013 7:33 PM
  • Hi Andy,

        

    I have tried executing both your xcopy commands but failed get the Date created timestamp.

        

    I will recommend that you switch from xcopy to robocopy command (refer to http://technet.microsoft.com/en-us/library/cc733145.aspx).

        

    In your case, you can replace both xcopy commands with a single robocopy command:

         robocopy C:\PROGRAM_FILES\faceshift \\Lacie-2big-nas\x\faceshift /mir /dcopy:t

        

    Since the data size is approx. 800GB, you can also create multi-thread copy to improve the performance.

         robocopy C:\PROGRAM_FILES\faceshift \\Lacie-2big-nas\x\faceshift /mir /dcopy:t /mt:128

        

    Also, take note that with the /mir option, if your destination contains files/folders that are not present in the source, they will be removed. If you are new to this command, I will advise you to try out various combination to get yourself familiarize with the command before use.

        

    Note:

    The /mir option is equivalent to the /e plus /purge options with one small difference in behaviour:

    • With the /e plus /purge options, if the destination directory exists, the destination directory security settings are not overwritten.
    • With the /mir option, if the destination directory exists, the destination directory security settings are overwritten.

        

        

    Hope that helps.

        

    Cheers,








    • Edited by Tas76 Thursday, September 12, 2013 1:51 PM
    Thursday, September 12, 2013 1:32 PM
  • Hi Tas76

    Thanks - I think I'll try that next.

    However, I put in a ticket to Lacie on this earlier... as I noticed that if I simply cut and pasted a folder (I used an older junk folder) on my C drive (or used the Xcopy strings), I could add a file and the folder created stayed at it's original date. But, on the Lacie NAS, even a cut and paste failed (initially it worked - but then, after a file is added, the creation date changes).

    This got me thinking that it might be some type of file error... and I've just got this back from Lacie Support.

    "I now have the answer to your question.   The attributes of the files are based on the NTSF file system.
    The 2big NAS is a lynux based program and it will not maintain those attributes.  It is a kernel problem that would require a major rewrite of the entire system.

    The solution is that you will need to have a Windows based NAS to keep the file attributes as they are.

    I am putting a link in here for the drive that would do what you are wanting to do.  It is Windows based and will hold the volume you want.  It is not necessary to fill all five slots to start with.

    http://www.lacie.com/uk/products/product.htm?id=10580"

    So it looks like this might be the error... I will investigate further and try out Robocopy too!

    All I'm trying to do is create a full clone/copy with folder creation dates intact, from one DAS to a larger NAS... once that's done, work will commence on the NAS from then on... currently I have set up some temp drives (DAS) and they're being used until I get this running properly.

    Thankfully the client is making choices at the moment, so there's still a few weeks before a rebuild needs to be finished. 

    Thanks for your help/patience!


         
    Thursday, September 12, 2013 4:30 PM

  • BTW - with the Xcopy, it was a 2 stage process. /s/e/k first then a copy over but using /d/t/e/k. Copying in the first pass and then overwriting the folders in the second pass (with the correct creation date).

    Thanks for the Robocopy/mir tip... that will work for bulk copying the data... sadly, when it's on the NAS, any additions to the folder change the creation date. Pretty sure it's the NAS file system (or lack of compatibility).

    Going to test some spurious data using some other DAS drives - as I think it's the NAS (as per Lacie's reply).

    Now I need to find a NAS that'll handle NTFS.

    But at least I feel I'm getting somewhere now - thanks :)

    Andy
    • Edited by Andy_White_101 Thursday, September 12, 2013 6:51 PM
    • Marked as answer by Cloud_TS Monday, September 16, 2013 2:39 PM
    Thursday, September 12, 2013 6:22 PM
  • Sorry ... that still doesn't fully answer the question.

    "I now have the answer to your question.   The attributes of the files are based on the NTSF file system.
    The 2big NAS is a lynux based program and it will not maintain those attributes.  It is a kernel problem that would require a major rewrite of the entire system.

    The solution is that you will need to have a Windows based NAS to keep the file attributes as they are.

    Actually ... no.

    No Linux ... just windows8 ... and any file changed/added/copied to the directory modifies the date/time attributes of that directory. Fine for modified, but not date created. I wish to turn off this behavior. Is it possible ... and if so ... how?

    Friday, January 31, 2014 7:20 PM
  • robocopy doesn't work with my video camera because the camera doesn't have a drive letter. 

    It seems so incredibly dumb I cant simply set a flag in file explorer.  My video camera always starts over with a 0000 file name whenever I clean up the camera.   I have to copy to folders with the date the folder name.

    Why in the world would I want to loose the create date information?  This is driving me absolutely nuts that I can keep the file creation dates.  These are very important.   I wish windows had rsync or cp -r where drive letter doesn't have to exist.

    Sunday, April 10, 2016 7:15 PM
  • Thanks for that, the second run with the /s/e/k did the trick of restoring the original directory created dates.

    Similar result for existing folders can be achieved with:

    nircmd.exe setfilefoldertime FolderNameHere "24-06-2015 17:57:11" "22-11-2015 10:21:56" 

    but only works with one directory and requires nircmd, but does allow custom time to be set.


    • Edited by PcR3 Tuesday, January 14, 2020 3:40 AM
    Tuesday, January 14, 2020 3:38 AM