I recently installed a Synology DiskStation on my network. I mounted it from an Ubuntu 12.04.1 computer with the Browse Network button in Nautilus 3.4.2. It shows up as afp://randall@DiskStation.local/photo/ in Nautilus.

So far, so good. I then uploaded a lot of photos to it, all with modifications times covering several months. When I looked at the directory of photos on the DiskStation, they all had modification times for the moment they were copied, not the modification times on the source computer. So much for sorting them by date on the DiskStation.

Is there a way to re-copy the files but have their modification date be preserved? Perhaps I mounted the DiskStation the wrong way. Perhaps Nautilus was the wrong tool to use. Any suggestions?

BTW, I have moved gigabytes of photos to a different NAS (Plextor PX-EH) over SMB/CIFS from Ubuntu 10.04, 10.10, 11.04, and 11.10 with modification times fully preserved. The problem must be with the Synology or some Ubuntu 12.04 software.

  • Does that NAS support SSH access? If yes you can use rsync or one of its GUI frontends to sync photos. Also, it should support SMB/CIFS too, which you can directly mount in Ubuntu and copy data with cp, rsync or any other tool.
    – Sergey
    Dec 6, 2012 at 8:02
  • rsync is the best copying/syncing tool to use. The -a (-rlptgoD) preserves modification time. See man rsync for more details. However, this requires SSH + rsync on both hosts.
    – Terry Wang
    Dec 6, 2012 at 10:38

5 Answers 5


I believe I have solved the problem. In Ubuntu 12.04, in Nautilus there are two ways to connect to the remote DiskStation NAS. One preserves modification times, one does not.

In the menu on the left-hand side of a Nautilus window, the Browse Network... button eventually leads to an AFP (Apple Filing Protocol) connection to the DiskStation, through which neither Nautilus nor cp -p copies preserve modification time. I tried disabling Apple support in the DiskStation, but in that mode the DiskStation wasn't even visible in Browse Network.

In Nautilus's File menu there is a Connect to Server... option that offers a host of protocols. I chose Windows, entered my credentials, and connected without trouble. In this mode, modification times are preserved, so I was able to re-copy my photos and have their dates preserved.

Thank you Sergey and david6 for your suggestions. Hopefully people will find this information valuable.

  • I've used "Connect to server" to connect to another Ubuntu machine from Nautilus on Ubuntu 18.04, and when copying files, Nautilus preserved the timestamps of directories, but not files. Midnight commander set all file modification timestamps to the time of the copy. BeyondCompare preserved file, but not directory, timestamps. Jan 5, 2019 at 11:59
  • You can add sshfs to the not-working list of methods Jun 15, 2021 at 18:04

Standard cp command has --preserve flag which preserved certain attributes (by default - mode,ownership,timestamps) when copying.

So something like this:

cp -rp /source/photos/folder /destination/photos/folder

should do the trick in the "normal" case. However, the afp:// thing in the URL confuses me - is it Apple Filing Protocol? All bets are off in this case.

One think I'd like to add - relying on file modification dates for cataloging your photos is very fragile. This is what image metadata (EXIF etc.) is for. Or, at least, just put them in directories according to their shooting date: photos/2012/12/05 etc.

  • Thanks for the tip, Sergey. If I have to use the command line, I will, but I was hoping that Ubuntu would be able to do the right thing through the GUI. It has in the past (pre-12.04). And yes, I was about to move the photos to folders organized by month when I noticed the modification time problem. Dec 6, 2012 at 7:48
  • I tried cp -p from a terminal and I got this error: "cp: preserving times for '.gvfs/AFP volume photo for randall on DiskStation/target_dir/image.JPG': Operation not supported". So I guess cp -p won't work. I'll try david6's suggestion. Dec 8, 2012 at 6:35
  • When using Mac OS to access the Synology NAS via terminal, cp -p does not preserve the time stamps. I've mounted the NAS via smb. I asked Synology support, and apparently the lack of preservation is the default behavior. On the other hand, rsync does preserve time stamps.
    – andrewj
    Jun 18, 2013 at 19:53
  • Only regarding images and if the EXIF Image taken date bothers you (and fragile indeed). If anyone wants to restore last-modified-dates from Exif Information, look here: → photo.stackexchange.com/a/69193/48640 Nov 5, 2016 at 6:20
  • Consider using cp -a instead. Nov 16, 2017 at 2:18

This is the classic push/pull problem, for remote copy.

The recipient host is not honouring the date-stamp of the received files. Nautilus has this same fault, from 10.04 LTS through 12.10 ..

This is solved (for Nautilus), when copying between two Ubuntu hosts, by always copying from the remote-host (source) to the local-host (recipient). (AKA 'PULL')

Your problem is with the NAS box, and not with Ubuntu.

You need it to honour the date-stamp of received files (by default).

Are you using NFS (Linux) or CIFS (Windows) for file sharing?

  • Thanks, david6. I'm definitely not using NFS, as it is disabled on the DiskStation, but Windows and Mac file sharing are enabled. When I connect to the DiskStation, Nautilus (I guess) only asks me for a username and password, not a protocol. The mount I get has "AFP" in its name, so I guess it chose the Apple file protocol. I'll try forcing a CIFS mount, see if that works, and then find a way to automatically get that. Dec 8, 2012 at 6:50

Turns out that preserving timestamps for files and directories is still a problem in 2019! I was copying files from an Ubuntu 16 machine to an Ubuntu 18 one over SFTP, using Nautilus on the Ubuntu 18, and all files had the current timestamp, but directories had the original timestamps. Other tools failed as well:

What did work was to mount the remote filesystem using sshfs:

$ sudo mkdir /mnt/remote-machine
$ sudo sshfs -o allow_other,default_permissions dandv@10.15.x.x:/ /mnt/remote-machine
$ cp -rp /mnt/remote-machine/path/to/files ./
$ # ... or use another file manager

Copying from the mounted path also enabled Midnight Commander to preserve the timestamps (but didn't help BeyondCompare).


To solve this issue on the client side, try specifying the protocol explicitly in mount options.

From man mount.cifs:

           SMB protocol version. Allowed values are:

           ·   1.0 - The classic CIFS/SMBv1 protocol. This is the default.

           ·   2.0 - The SMBv2.002 protocol. This was initially introduced in
               Windows Vista Service Pack 1, and Windows Server 2008. Note that
               the initial release version of Windows Vista spoke a slightly
               different dialect (2.000) that is not supported.

           ·   2.1 - The SMBv2.1 protocol that was introduced in Microsoft
               Windows 7 and Windows Server 2008R2.

           ·   3.0 - The SMBv3.0 protocol that was introduced in Microsoft
               Windows 8 and Windows Server 2012.

           Note too that while this option governs the protocol version used,
           not all features of each version are available.
sudo mount -t cifs //mynas/Disk1share /mnt/Data/NAS -o user=me,password=mine,uid=$(id -u),vers=2.0

Your Answer

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

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