How can I not preserve file timestamps?

I would like to copy some files out of a nix store into Google Drive. The hitch is that the nix store sets the modification time of every file inside of it to 1970-01-01 00:00:00Z , so that the modification time cannot be used to break reproducible builds. However, I would prefer to have the upload time correctly reflected in Google Drive.

  1. I could copy the file out of the nix store into another file in the local filesystem, but I would strongly prefer to avoid this step, as it's unnecessary and the files can be quite large.
  2. I could pass an option to rclone to not preserve modification time, not unlike cp 's --no-preserve=timestamps option. (Although, cp doesn't preserve timestamps by default) However, I'm not seeing any documentation that this option exists, if it exists at all.
  3. I tried creating a symlink to the file inside the nix store, hoping that rclone would pick up the modification time of the symlink, but this fails. For example, if I try this to copy the rclone executable to google drive:
$ ls -lh /nix/store/kvrpcbi3ph4m9a8jjp7bd445w690wdqs-rclone-1.48.0/bin
total 17M
-r-xr-xr-x 1 root root 34M Dec 31  1969 rclone

$ ln -s /nix/store/kvrpcbi3ph4m9a8jjp7bd445w690wdqs-rclone-1.48.0/bin/rclone rclone-symlink

$ rclone copy --copy-links rclone-symlink remote:

However, this symlink trick doesn't work, as rclone is still uploading the file with the timestamp 1970-01-01 00:00Z. (Although, as it turns out, cp --preserve=timestamps exhibits the same behavior)

If you want a hack. You could mount the local filesystem elsewhere to another directory with the 'rclone mount /data/log ~/t --no-modtime' set. That will give you the mount time and not the actual time. It isn't really 'created' time. Then you can sync from there. It'll be slower a little and more CPU since you're going through rclone to sync but it shouldn't be too bad.

Such an option doesn't exist at the moment.

A drive specific option would be easy to do... You'd just need to not do this line - you could try commenting it out to see if that would work.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.