Check out our Monthly Survey Page to see what our users are running.
Anyone know how to copy a folder, keeping the creation date of the original?
Page: 1/2»
  Go to:
I want to copy a folder with my Lutris games, and I want to keep all the timestamps (creation date and modification date) and ownership of the Folder, subfolders, symlinks and files.
damarrin 28 May
rsync? Or compress it, that should preserve dates and times.

Last edited by damarrin on 28 May 2021 at 7:08 pm UTC
tuubi 28 May
Good old `cp -a` (or --archive) should do the trick. Check the man page for more info.
Quoting: tuubiGood old `cp -a` (or --archive) should do the trick. Check the man page for more info.
That command keep the modification date, but not the creation date..

I need the copy to be a perfect clon.
tuubi 28 May
Quoting: Comandante Ñoñardo
Quoting: tuubiGood old `cp -a` (or --archive) should do the trick. Check the man page for more info.
That command keep the modification date, but not the creation date..

I need the copy to be a perfect clon.
Sorry, I don't know a way around that beyond cloning the whole file system. Archiving, rsyncing or whatever won't help you there. The file system updates the ctime whenever an inode is changed in any way, and as far as I know the Linux kernel doesn't have a mechanism for overriding this behaviour.

I don't think Lutris cares about ctimes though, so I guess you have some other reason to worry about it.
Lachu 29 May
Use cp -p

From manual page:
-p implicts --preserve=mode,ownership,timestamps

It's my translation to English, so sorry it was wrong. I have localized manuals.
Lachu 29 May
Of course,

--preserve=timestamps should also do the trick.
Lachu 29 May
Also
cp -pP

It will copy symbolic links content instead location it points to. The -P do the trick.

From manual
-P, --no-dereference
never travel through symbolic links in source
tuubi 29 May
I suggested `cp -a` earlier, and it already implies --preserve=all. But there's no way to make cp preserve the ctime timestamp.
Quoting: tuubiI suggested `cp -a` earlier, and it already implies --preserve=all. But there's no way to make cp preserve the ctime timestamp.

And If I play with the system time before making the copy?

What is more fast? The use of cp or Rsync?
denyasis 30 May
I think, for this case, rsync and cp would be about the same. Rsync's advantages are that it can compress over a network and that it can "update", skipping unchanged files that already exist in the destination directory.

Unless your doing one of those things, I find them to be about the same in terms of speed.

Quoting: Comandante ÑoñardoAnd If I play with the system time before making the copy?

That's a clever idea! Although, wouldn't you have to alter the system time for every file just before you copy it to ensure every file has the same time as the old? I wonder if that's is scriptable in bash?

I can't remember what is called exsctly, but I think you might want to consider disabling the NTP deamon/service thing so the system doesn't automatically "fix" and resync to the correct time in the middle of you work. Or take the computer in question off the internet. Prolly easier to disconnect.
While you're here, please consider supporting GamingOnLinux on:

Patreon, Liberapay or PayPal Donation.

This ensures all of our main content remains totally free for everyone with no article paywalls. We also don't have tons of adverts, there's also no tracking and we respect your privacy. Just good, fresh content. Without your continued support, we simply could not continue!

You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
Login / Register

Or login with...
Sign in with Steam Sign in with Twitter Sign in with Google
Social logins require cookies to stay logged in.

Livestreams & Videos
Community Livestreams
Latest Forum Posts