Google Drive does not preserve file modified date / time

Google Drive does not preserve file modified date when copying and overwriting an existing file. The file modified date is an important piece of information about the file and should not be lost by a file copy operation.

Example using Google Drive with web browser file upload:


1) Upload a new file to Google Drive via web browser. The modified time is correct. (i.e. the modified time in the cloud matches the modified time of the local file.)

 

2) Upload the same file to Google Drive via web browser, overwriting the existing file, and it now has the wrong modified time. Expected behavior: When copying a file and overwriting an existing file, the modified time of the source file should be preserved.

Example using Google Drive for Desktop (Windows):


1) Copy a new file to the "G:\My Drive\" folder. The modified time matches the original source local file. (The file's modified time is correct, both in the cloud and the local cached modified time.)

2) Copy the same local file to the "G:\My Drive" folder and overwrite the original. There are now two problems:

a) The copied file has the wrong modified time in the the cloud (checked using Google Drive via web browser). The modified time is the current time instead of the source file's modified time.

b) The file's local cached metadata in Google Drive for Desktop does not reflect the same modified time as the cloud storage. (Checked by comparing the modified file time on "G:\My Drive" to the same file in the web browser).

The behavior of Google Drive for a file copy operation with overwrite is not standard or expected behavior for most file systems (e.g. NTFS, EXT4, BTRFS, XFS, etc). (updated 2023-May-01).  It creates many problems with file and directory comparison tools, backup tools, etc. This behavior creates situations where data is lost because a user or utility makes the wrong decision about a file because the modified date is incorrect. (i.e. an old file with a new modified date)

20 65 38.3K
65 REPLIES 65

Final conclusion is: if GoogleDrive emulates fixed drive (as it appeares in the system), users should see no difference in the behavior with real fixed drive. Period.

absolutely disagree. we know that Drive is not trying to emulate a fixed drive experience. another example here is that in Drive you can have objects named the exact same in the same location. Local file systems do not support this. 

Drive for desktop is trying to provide a similar, but different, experience and is not trying to emulate it.

Screenshot 2022-05-05 at 05.40.05.png

Drive for desktop on Windows (haven't tried it on Mac) emulates it as purely fixed drive. Windows see it as fixed drive (in drive properties). Besides, as described above, the real bug is that if I overwrite some file - I see modified time of the source file. But if I logoff/logon from the Drive for desktop - ups - now I see modified time equal to the moment the file was overwritten!

I realize that different users can prefer  different behavior that's why the best solution is to let user to choose it. Let's say, legacy or modern filetime modification, why not.

@stevelarsen wrote:
> "absolutely disagree. we know that Drive is not trying to emulate a fixed drive experience."

This is not correct.  Note the reply to this issue from Google staff:

@JC- wrote on 12-06-2021 02:59 PM  (LINK)
"We aspire to behave as any other mounted drive on your computer (and follow OS specific oddities), but it looks like we are missing the mark."

My point here - with my previous post - was to provide some clarification about the available options, not to engage in a dispute of arguments or opinions.
I understand that if someone reaches this page it is because theyโ€™re already facing a similar issue and most likely agree that Google Drive is to blame. Thatโ€™s not my opinion though. But indeed my observations were far from a real-life scenario and were more theoretical.

So, let me take a step back and provide a more realistic overview of this โ€œissueโ€.

Letโ€™s imagine this: User A (letโ€™s call him Adam) always uses the web UI and user B (let's call him Brian) uses mostly the local file explorer but also uses the web UI when needed.

Adam is always creating and uploading files to Google Drive and, as he uses the web UI, he sees the dates in which files were created or modified (including when files are renamed, which is indeed a modification of the file, if not of the fileโ€™s content). In his mind, when he has to look for a file he thinks about the date of the last modification, and he understands โ€œmodificationโ€ as any change made to the file (including its name).

Meanwhile, Brain is creating new files in Microsoft Excel and syncing them up to Google Drive by moving the files to the Google Drive folders or the mounted virtual drive (typically G:). Since each of those files is new to Google Drive they will each get a new file ID and in the first sync Google Drive will query the (local) files metadata to respect the last modification as reflected in the operating systemโ€™s metadata for those files.

Then Brian renames or overwrites the same files and, as he is used to the Windows behavior, he expects the files to keep the previous modification dates (excluding the remaining or overwriting). However, the files are not new to Google Drive anymore, and, therefore, have their own file IDs, which means that Google wonโ€™t have to query the local versions of the files anymore. And so, as any proprietary file system, Google Drive updates the file as it sees fit, in this case, Iโ€™d say, it updates the file based on what Google believes that most people will perceive as the correct option.

This brings us to the real issue here: different people have different opinions on what is the correct modification date.

Knowing this, we must consider what Google is trying to do for a while now, with Google Workspace: change the way we work, by moving from legacy systems and working on Cloud-native environments.

Naturally, this will piss some people off, because they will say that if Google is trying to offer a way to reach interoperability with local file systems then Google should respect the local file systemsโ€™ behaviors. And they are right, to a point. Google arrived later and needs to offer some compatibility features, for sure! But the point here is that Google canโ€™t ignore its own file system and, most importantly, the perception of most of its users, of which the vast majority prefers to use the web UI.

So, hereโ€™s the million dollar question: when Adam and Brian rename or override a file, who is entitled to see the last modified date that each of them considers to be the right one?

  • Should Google disregard its efforts to create a new and disruptive, cloud-native way of working to adapt to local file systems?
  • Or should Google preserve the work done and do not change what millions of Google Drive users understand to be the correct behavior?

A possible solution for this would be to force the sync client to always use the metadata from the local version of the file, except when the file is changed online (and syncs โ€œdownโ€ the last modification made on the web UI), but even this would not be flawless, as it would still present the issue of causing conflicting opinions, because while Adam would think that the file was modified yesterday, after asking a colleague to upload the correct version of the file, for example, Brain, on the other hand, would think that the file should show the local modification date.

This can obviously create a lot of debate but the point is that this is ultimately a business decision, not a technical one.

In my opinion, a better solution would be - in addition to preserving the local metadata - to offer to users the option to choose, on the web UI, which modification date to see. For instance: โ€œDate modifiedโ€ (on the web UI) ,and โ€œSynced modified dateโ€

Google Driveโ€™s real fault here is to make users believe (by not warning them of the potential issues) that the sync between local file systems and Google Drive has no limitations. This could also be remedied (or at least greatly improved) by showing a new warning dialog when setting up the sync client for the first time, or, even better, every time a user tries to rename or overwrite a file (and requiring a confirmation).

To finish, I just want to say that this is only my opinion - possibly biased, maybe - and that I really hope not to offend anyone that thinks differently.

If you look at my example here where I upload a file from a local file system which is an entirely different file to what was in the Drive you can see why it's critical that Drive report the last modified time always. Without showing users the most recent date/time that this file was modified you are losing the ability to see that it actually was modified.

modifying-files-date-modified.mov

As mentioned by CloudGardians, the best option is to let user the option to choose, on the web UI, which modification date to see. 

As I look at this more and more I see that the local file system is what is wrong and needs to be changed. In some cases the local file system will update the date modified time when a rename occurs. It should always do this as the file was modified.

local-file-system-is-wrong.mov 

It looks like there is inconsistent rename and file mod_time behavior on local Google drive (which could be a different but related bug).  (EDIT: I tested the same steps on Windows and it has the same inconsistent behavior depending on where the file was first uploaded, via web UI or via Drive for Desktop)

@stevelarsen wrote:
> "In some cases the local file system will update the date modified time
> when a rename occurs. It should always do this as the file was modified.
"

The file *contents* were not modified.  MacOS is POSIX certified (apparently since  MaxOS 10.5).  The file modified time (mod_time) should only change when the *contents* of the file change.  Renaming a file should NOT change the modified time.  Copying and moving a file (with or without overwriting an existing destination file) should also NOT change the modified time (the source file modified time is always preserved).  Try these operations on your local file system (e.g. APFS) and see what happens. 

(renaming may or may not change the "change_time" which is a different time stamp tracking when file attributes change.)

@stevelarsen wrote "As I look at this more and more I see that the local file system is what is wrong and needs to be changed."

Yes, it is "wrong" because it does not match the modified time that is stored in the cloud (and a bug in my opinion).  The behavior of the cloud modified time is also "wrong" because it doesn't follow POSIX file system rules. the modified file time should not change for a rename operation since the file contents have not changed. (POSIX "rename" behavior)

@WayneSherman now we're getting somewhere!

It took 50 comments to let everyone know that there are two different types of "modified" date references, and that is how it should be.

mod_time - when the contents of the file changed. File actually edited.
change_time - when anything about the file changed, like a rename/move.
access_time - when anything happened to the file, including just opening it.

That should logically mean that access_time will always be the most recent value, followed by change_time and mod_time will always be the oldest reference. They all have value when working with files, and shouldn't be randomly (it isn't random, really, which @CloudGuardians and others have shown) changed, and all values should be available, so users themselves can decide how to organise and manage them.

I assume you'd be ok with GfD altering the change_time as long as it doesn't touch the mod_time whenever the contents of the file hasn't changed (which means the hash of the file is the same as before)? But if the file hash is different, it should updated mod_time because that means it is in fact a "different" file, right?

> The behavior of the cloud modified time is also "wrong" because it doesn't follow POSIX file system rules.

To correct that, I don't think the mtime file copy behavior is actually defined as part of the POSIX standard (for "rename" I think it might be).  Additionally on Linux what happens is not dependent on the kernel and not dependent on the file system.  It depends on the application and/or API implementation:

KDE KIO, Dolphin, and Konqueror = preserves mtime
https://bugs.kde.org/show_bug.cgi?id=55804
https://bugs.kde.org/show_bug.cgi?id=24443

Nautilus / Gnome Files (glib/GIO) = preserves mtime
https://github.com/GNOME/glib/commit/39b3b4148456e596fa0ada24d47bcc76c1984172

XFCE Thunar - preserves mtime (tested myself)

GNU "cp" program does not preserve mtime unless using "-p" (--preserve, see also -a)

DOS / Windows command line COPY, and Windows File Explorer = preserves modified time

v0v
Bronze 4
Bronze 4

More than a year has passed since the date of the first topic. And we even have had a comment from the Staff command in the thread. And Google has done nothing with the discussed problem yet.  ((

I have a great use case using R and RStudio with a Google Drive folder, but I need to be able to have "file.info()" function in R *see* the file times, and it gets nothing.  

Is that a  Google Drive problem or an R file.info() problem?

Here is the file.info() information from Google Drive files and native Windows file system files below:  (Google Drive first, times NA)

> str(PathDetails)[]
'data.frame': 17 obs. of 7 variables:
$ size : num NA NA NA NA NA NA NA NA NA NA ...
$ isdir: logi NA NA NA NA NA NA ...
$ mode : 'octmode' int NA NA NA NA NA NA NA NA NA NA ...
$ mtime: POSIXct, format: NA NA NA NA ...
$ ctime: POSIXct, format: NA NA NA NA ...
$ atime: POSIXct, format: NA NA NA NA ...
$ exe : chr NA NA NA NA ...
NULL
> summary(PathDetails)
size isdir mode mtime ctime atime exe
Min. : NA Mode:logical Min. : NA Min. :NA Min. :NA Min. :NA Length:17
1st Qu.: NA NA's:17 1st Qu.: NA 1st Qu.:NA 1st Qu.:NA 1st Qu.:NA Class :character
Median : NA Median : NA Median :NA Median :NA Median :NA Mode :character
Mean :NaN Mean :NaN Mean :NaN Mean :NaN Mean :NaN
3rd Qu.: NA 3rd Qu.: NA 3rd Qu.:NA 3rd Qu.:NA 3rd Qu.:NA
Max. : NA Max. : NA Max. :NA Max. :NA Max. :NA
NA's :17 NA's :17 NA's :17 NA's :17 NA's :17
>

file.info() for native Windows file system folders next:  (times present)

[1] "HospitalsbyZip.R" "HospitalsbyZip.Rproj"
> DataFilePath <- getwd()
> PathDetails = file.info( list.files( DataFilePath))
> PathDetails = PathDetails[ with(PathDetails, order(as.POSIXct(ctime))), ]
> FileList = rownames( PathDetails )
> nfiles = length(FileList)
> str(PathDetails)
'data.frame': 2 obs. of 7 variables:
$ size : num 218 162
$ isdir: logi FALSE FALSE
$ mode : 'octmode' int 666 666
$ mtime: POSIXct, format: "2022-07-28 16:09:51" "2022-07-28 16:15:25"
$ ctime: POSIXct, format: "2022-07-28 16:09:49" "2022-07-28 16:15:25"
$ atime: POSIXct, format: "2022-07-28 16:09:51" "2022-07-28 16:15:32"
$ exe : chr "no" "no"

 

Please post your question as a new topic and continue the conversation there since it is off topic on this thread.  The file times for Google Drive for Desktop files are available using standard Windows API calls (for example they show up correctly in File Explorer and via the DIR command in a command prompt), so I would suggest the problem is with R.

Dear 

I have a question. 

There is a Google drive in the cloud and there is a google drive folder on my local hard disk

I am working on a file in the folder on the local hard disk and I update it. I am not connected to internet. I connect the internet and synch the drive when I get my pc connected to internet. 

I am going out and working on the same file that is available on the cloud.

I return to work and open the file after synching the google drive on the local hard disk. 

Which file will be updated? the file on the local hard disk or the file on the cloud? 

Kindly cure my ignorance. 

Thanks and regards. 
Ranjith K

 

 

As long as you are using the same computer, you will always be updating the local file. Then whenever you have Internet access, the online copy will be updated.

If you, or anyone else, updates the online version while your computer is offline, then there's risk of version conflict.

Versions are synced with a time reference, and the latest version, time-wise, is the one that's going to be active.

So in the scenario where the online version has been updated when you were offline, the online version will overwrite your offline version. As it should. 

While I can appreciate the concern and issues with Drive metadata, for your purposes of versioning why not just use a data version control system that supports Google Drive or Google Storage on the backend?

Thank you for your reply, but I don't think you understand the problem.  Like many others, we are using Google Drive for Desktop as a Windows file server replacement.  Users expect their "G:\" drive to behave like other local drives and file server shared drives.

I should chime in here and say that my particular problem actually had to do with an incomplete file path specification.

file. Info(). In R does seem to behave as expected with the G.Drive references.

 

 

 

 

 

 

Outside of the expected file behavior timestamps of overwriting a file, you CAN preserve the originating device timestamps. I learned that having Google desktop to be setup as the g:\, if needing to copy files over from device A to Google drive g:\, copy them right on over...both timestamps are the same! I see in Google drive on my phone, the file modified timestamps reflect the true timestamps of the originating device.  I  did this by accident. Could be the jump drive file system or how win11 decided it's write operations would match originating device?

Hi, excuse me, but is the timestamp correct after you logout and logon into the account? In my case timestamp had been correct until this operation. It looks like in googledrive's filecache everyting works properly and this correct cache has been reset after login.

This wouldn't be such an issue if Google Drive had more options to sort by date -- like file create date, first-version-date, etc. I often don't care about the "modified date" in Drive and would much prefer the date the first version of a file was uploaded, but there is no way to do that (even after all these years...) 

Is het me, or have they fixed it? On my Mac I have version 92.0.0.0 and when I copy files into my Google drive, it retains the last modified date. This is different behavior than I saw before. I would be nice if they had announced this some how.

Hi CeesMechielsen,

as was written before, it looks like the correct modified date is been preserved until it is been preserved at Google's Drive cache on local disk. After new logon at new PC a user can be surprised by "suddenly" changed modified time.

I am so glad I finally found people dealing with this file date issue! I am new to using Workspace and in a new organization where I am trying to improve our file organization and naming. But any time I change a file name it updates the date, which then wipes out info I need about the file's history. Extremely frustrating and preventing me from having a well organized file system for the organization.

Another option would be to allow the File Description field to show up in the Drive file list view so I could use that field for my updated file information and leave the file name the same. 

Top Labels in this Space
Top Solution Authors