-1

I copy files a lot, whenever I copy files I want their metadata (specifically the metadata that tells me when the file was created), to stay the same with the copy. On windows i usually just use robocopy to accomplish this.

However as far as I can tell on ubuntu it just makes the timestamps for when a file was created the same as when a file was last modified.

So my question is does ubuntu actually store the timestamps for when a file was created?

And could I use chmod, or cp -p or some FOSS to copy the metadata? I'm trying to stop using windows as much as possible.

so far I've searched the forum and found these answers to similar questions, i haven't tested any of them yet: How to copy only file attributes (metadata) without actual content of the file?

avconv how to copy all stream and merge metadata (fix creation date)?

terras
  • 1

1 Answers1

0

Which particular metadata are supported depends on the filesystem.

The default filesystem in Ubuntu, ext4, does support creation time (crtime) but there is no trivial way to view it and it isn't something that can be set to an arbitrary value. It is therefore not preserved when copying a file, and it's dubious that it should be as it's to indicate the time the file entry was created, not the content of the file.

As you have noted, the change time (ctime) is preserved. That's the time of the last change of metadata for the file, with mtime being same but for file content.

Several other Linux filesystems also do store the crtime, but I do not know of any way to view that time with simple tools, only by doing a debugfs as root on the raw device. And as I say, there is no way to preserve it when copying the file anyway.

You are going to have to do without the creation time of files, I think.

grifferz
  • 1,026