11

When I move files from one directory to another, the timestamp of the files changes. For example, if the file was created with a date 2013-01-01, when I move it to a different directory, the final file will have the date of the move, not of the creation.

How to fix this?

Nathan Osman
  • 32,155
Kaf
  • 1,255
  • I couldn't reproduce this behavior. When I move a file its creation date doesn't change, even when I rename the file. – Eric Carvalho Feb 26 '13 at 15:58
  • 1
    i am using ubuntu version: 12.10. I take photos using a digital camera with a micro sd. I unplug it from the camera and insert into a card ready on the computer with ubuntu. Then i copy it to a shared windows server 2000 folder. The files end with changed date. – Kaf Feb 26 '13 at 21:59

1 Answers1

5
  • cp -r -p SOURCE DESTINATION
  • cp -r --preserve=mode,ownership,timestamps SOURCE DESTINATION

These two commands do the same thing. The Second allows you to chose what remains the same. I am not aware of a way of specifically doing this with mv, but I believe this is mvs default behavior.

Alternatively, you could try copying hard-links, which is much more similar to mv, as suggested here:

  • cp -p -r -l source/date target/

I believe the problem you are experiencing is due to an ntfs/fat partition? If this is true, try setting up a rule in /etc/fstab that uses your uid.

earthmeLon
  • 11,247
  • 4
    but to be user friend, i would prefer that the nautilus in ubuntu did that. It is not pratical to make a command line everytime i need to copy files. More suggestions? – Kaf Feb 27 '13 at 00:48