Restoring files with wrongly updated file-dates

macstatic

macrumors 65816
Original poster
Oct 21, 2005
1,063
29
Norway
For some unknown reason many files on a drive have been updated with their creation and modification dates to June 22nd 2015 even though these are old files. I have no idea why -anyone know what could cause this to happen if I didn't do it myself?

Anyway I have a backup drive (with their correct dates) but I want to ensure I don't overwrite anything new or edited, so what would the best way be to fix this?
 

Partron22

macrumors 68020
Apr 13, 2011
2,471
698
Yes
Apple's filesystem does this occasionally, to no other apparent purpose than to make it difficult for users to keep track of when their files were created or last modified.
Creation date is read only under Applescript. Mod date, you can change that way. Both dates may be accessible via Terminal, but as there's typically thousands of files involved, fixing things is a major undertaking.
Might be best to just periodically print out the creation and mod dates of all your files, so when you need that info, there's a chance you'll be able to find it.
Remember, as consumers, we're not supposed to care about complicated things like files, and Apple actively encourages use not to by implementing annoying behaviors like this.
 

macstatic

macrumors 65816
Original poster
Oct 21, 2005
1,063
29
Norway
Yeah, Apple has surely become more of an entertainment company than the computer company it once was :mad:

The first thing I have to do is probably find out how many and which files are affected by the date change. I've never heard about this happening to anyone else -so it randomly occurs?
 

MacTech68

macrumors 68020
Mar 16, 2008
2,185
149
Australia, Perth
I've noticed TechToolPro do this when optimizing files. I wonder if MacOS X's own file optimization mechanism does the same thing?

It's pretty annoying if you use modification date to track a file's history/legacy.
 

Partron22

macrumors 68020
Apr 13, 2011
2,471
698
Yes
It's pretty annoying if you use modification date to track a file's history/legacy.
I've taken to prepending/appending a date string to file names where I care about this. It can be a PITA sortwise.
If Apple's going to use these dates for non-consumer purposes, they should make them invisible, so as to not to mislead people into thinking that the info can be relied upon.
 

macstatic

macrumors 65816
Original poster
Oct 21, 2005
1,063
29
Norway
Might be something going wrong with a Volume header. iTunes and some of the other Apps that keep files in their own database seem to think they have change rights as well.
Terminal -> Setfile will get you back what you want if it's only a few files.
From what I understand this allows you to copy the modification date over to the creation date, but in my case I've messed it all up so there's no correct modification date to copy from.
Having investigated it further it might seem like I've accidently messed it up using an app such as "A Better Finder Attributes" or similar, but it does seem a bit odd that I would do something like that without noticing.

MacTech68: you're only talking about the modification date here, right? I agree it's a PITA, but I could live with that. My issue is that the Creation dates are also messed up in lots of photos, so I don't know any longer when they were shot. Perhaps restoring them from backups is the only way to solve this (time consuming!).
 

MacTech68

macrumors 68020
Mar 16, 2008
2,185
149
Australia, Perth
MacTech68: you're only talking about the modification date here, right? I agree it's a PITA, but I could live with that. My issue is that the Creation dates are also messed up in lots of photos, so I don't know any longer when they were shot. Perhaps restoring them from backups is the only way to solve this (time consuming!).
I've not investigated what happens to the creation date, but I have a vague recollection that both are modified to the current date.

Regarding your dilemma, do the photos contain exif data to be able to extract the date taken and apply it to the creation & modification date via a batch process?
 

Partron22

macrumors 68020
Apr 13, 2011
2,471
698
Yes
If these are photo files, this AppleScript, properly modified with some shell scripting added (Setfile) might be able to restore file dates for you enmasse: Extracting Metadata
Created and modified dates are part of the metadata on my image files.

I didn't look hard, but it's a common enough problem that someone may have written a script/Automator action that does exactly what you need.