Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
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
    
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
add comment

1 Answer

  • 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.

share|improve this answer
1  
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 0:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.