Ask / Submit

[answered] Cut/Paste files retains the original timestamp but Copy/Paste does not [answered]

asked 2018-06-16 17:37:22 +0300

jimjamz gravatar image

updated 2018-06-22 13:30:06 +0300

As a user of Sailfish OS

I want to be able to cut/copy paste files from one location to another

And those files have the same date and time stamp as they originally had

So that I can organise when files were originally created/modified.

Scenario: Cut/Copy and Paste a File in the Home Directory
  Given I am in the home directory
  And the following file exists:
    | Name     | Size     | Date       |
    | test.txt | 10.00 KB | 30/05/2018 |
  When I <action> the file "text.txt"
  And I navigate to the directory "./Documents"
  And I Paste
  Then I should see the following files:
    | Name     | Size     | Date       |
    | test.txt | 10.00 KB | 30/05/2018 |
  | action |
  | Cut    |
  | Copy   |

This scenario works for Cut but fails for Copy:

 expected '30/05/2018'; got '16/06/2018'

When a file is copied and pasted to another location, even a sub-directory of the original location, a new timestamp is generated.

edit retag flag offensive reopen delete

The question has been closed for the following reason "the question is answered, an answer was accepted" by rgrnetalk
close date 2018-06-23 10:48:56.553677



When you move file or dir, it is just moved in filesystem. When you copy it a new file is created,and it gets a new created timestamp. Last modified timestamp is separate in many file systems.

Manatus ( 2018-06-16 17:58:34 +0300 )edit

Yes, standard filesystem behaviour, nothing new here.

juiceme ( 2018-06-19 09:02:33 +0300 )edit

I understand that this is the normal filesystem behaviour, as I see the same results on my other Linux systems. However, I'm left a little confused. Is the timestamp value that I am seeing, a created timestamp (not modified)? When I copy the file to a new directory, I see the new timestamp. If that is the created timestamp then I can accept that. However, it seems the value tries to be both. If I edit the file then I can see that the timestamp is updated once again, implying it is now displaying the modified timestamp.

jimjamz ( 2018-06-21 12:05:53 +0300 )edit

1 Answer

Sort by » oldest newest most voted

answered 2018-06-21 14:16:10 +0300

juiceme gravatar image

Whatever the file manager operations you are performing, in the end they map to filesystem operations. You need to understand that even though the "copy", "cut", "paste" are separate operations they map into single transaction operated on the filesystem.

  1. The "copy/paste" case maps to file copying. (command "cp", a new file is created and the content of the existing file is copied into it) Hence the new file will have new timestamp
  2. The "cut/paste" case maps to file moving. (command "mv", the file content is not touched, only filesystem metadata is rewritten) Hence the timestamp says same.

A special case is "mv" over filesystem boundary, for example from one partition to another. This maps internally to copy+delete operation and will result in a new timestamp for the end result.

edit flag offensive delete publish link more

Question tools

1 follower


Asked: 2018-06-16 17:37:22 +0300

Seen: 158 times

Last updated: Jun 22 '18