I have to move files from my internal storage to the SD Card. While cp -p does its job fine to an ext4 formatted card, moving/copying files to exFAT only keeps the file modification time but sets creation to the actual time.

Some of my daily routines on my Windows computer depend on creation time for file sorting etc. To make it even worse, copying from my phone over MTP discards both time-stamps, yielding anything except jpeg's unsortable!

So what I need is just a bit of bash magic which:

  1. Reads the atime* of a file/directory
  2. Copy the file/directory to destination with cp --preserve t
  3. Touch the destination file/dir's ctime with the stored one
  4. Proceed and recurse ???. profit

*Android mounts the storage with noatime/relatime and thus - which I checked myself - atime gives the real creation time here

  • Linux kernel doesn't maintain the creation time but only the changed time (ctime), modification time (mtime) and access time (atime) and ctime can't be changed easily. So, what is your goal now? – Firelord Dec 28 '15 at 19:34
  • my goal is co "convert" ext4 atime to "creation time" on exFAT – t-c Dec 29 '15 at 21:00
  • But there is no creation time, only changed time. – Firelord Dec 29 '15 at 21:05
  • yes it has - on Windows. i know what you mean, there is no way to set if from *nix. so, maybe somehow dump all timestamp data to a text file on Android, then parse and feed it to filetouch.exe on Windows? – t-c Dec 30 '15 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.