How can I preserve file modification times when copying to a NAS?
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.
nautilus photo-management nas timestamp
add a comment |
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.
nautilus photo-management nas timestamp
Does that NAS support SSH access? If yes you can usersync
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 withcp
,rsync
or any other tool.
– Sergey
Dec 6 '12 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 '12 at 10:38
add a comment |
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.
nautilus photo-management nas timestamp
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.
nautilus photo-management nas timestamp
nautilus photo-management nas timestamp
edited Dec 8 '12 at 19:43
Jorge Castro
36.2k105422617
36.2k105422617
asked Dec 6 '12 at 7:27
Randall CookRandall Cook
2,16541220
2,16541220
Does that NAS support SSH access? If yes you can usersync
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 withcp
,rsync
or any other tool.
– Sergey
Dec 6 '12 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 '12 at 10:38
add a comment |
Does that NAS support SSH access? If yes you can usersync
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 withcp
,rsync
or any other tool.
– Sergey
Dec 6 '12 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 '12 at 10:38
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 '12 at 8:02
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 '12 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 '12 at 10:38
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 '12 at 10:38
add a comment |
4 Answers
4
active
oldest
votes
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.
– Dan Dascalescu
Jan 5 at 11:59
add a comment |
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.
– Randall Cook
Dec 6 '12 at 7:48
I triedcp -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 guesscp -p
won't work. I'll try david6's suggestion.
– Randall Cook
Dec 8 '12 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 viasmb
. 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 '13 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
– Frank Nocke
Nov 5 '16 at 6:20
Consider usingcp -a
instead.
– Pablo Bianchi
Nov 16 '17 at 2:18
add a comment |
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.
– Randall Cook
Dec 8 '12 at 6:50
add a comment |
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:
- BeyondCompare did not preserve the timestamps of directories
DoubleCommander gave random errors throughout the copying process (no other tool did that; both machines use SSDs and are on the local Wi-Fi)- Midnight Commander lost the timestamps for both files and directories
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).
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f226033%2fhow-can-i-preserve-file-modification-times-when-copying-to-a-nas%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
– Dan Dascalescu
Jan 5 at 11:59
add a comment |
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.
– Dan Dascalescu
Jan 5 at 11:59
add a comment |
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 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.
answered Dec 8 '12 at 19:40
Randall CookRandall Cook
2,16541220
2,16541220
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.
– Dan Dascalescu
Jan 5 at 11:59
add a comment |
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.
– Dan Dascalescu
Jan 5 at 11:59
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.
– Dan Dascalescu
Jan 5 at 11:59
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.
– Dan Dascalescu
Jan 5 at 11:59
add a comment |
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.
– Randall Cook
Dec 6 '12 at 7:48
I triedcp -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 guesscp -p
won't work. I'll try david6's suggestion.
– Randall Cook
Dec 8 '12 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 viasmb
. 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 '13 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
– Frank Nocke
Nov 5 '16 at 6:20
Consider usingcp -a
instead.
– Pablo Bianchi
Nov 16 '17 at 2:18
add a comment |
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.
– Randall Cook
Dec 6 '12 at 7:48
I triedcp -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 guesscp -p
won't work. I'll try david6's suggestion.
– Randall Cook
Dec 8 '12 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 viasmb
. 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 '13 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
– Frank Nocke
Nov 5 '16 at 6:20
Consider usingcp -a
instead.
– Pablo Bianchi
Nov 16 '17 at 2:18
add a comment |
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.
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.
answered Dec 6 '12 at 7:40
SergeySergey
36.3k98799
36.3k98799
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.
– Randall Cook
Dec 6 '12 at 7:48
I triedcp -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 guesscp -p
won't work. I'll try david6's suggestion.
– Randall Cook
Dec 8 '12 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 viasmb
. 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 '13 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
– Frank Nocke
Nov 5 '16 at 6:20
Consider usingcp -a
instead.
– Pablo Bianchi
Nov 16 '17 at 2:18
add a comment |
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.
– Randall Cook
Dec 6 '12 at 7:48
I triedcp -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 guesscp -p
won't work. I'll try david6's suggestion.
– Randall Cook
Dec 8 '12 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 viasmb
. 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 '13 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
– Frank Nocke
Nov 5 '16 at 6:20
Consider usingcp -a
instead.
– Pablo Bianchi
Nov 16 '17 at 2:18
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.
– Randall Cook
Dec 6 '12 at 7:48
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.
– Randall Cook
Dec 6 '12 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.– Randall Cook
Dec 8 '12 at 6:35
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.– Randall Cook
Dec 8 '12 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 '13 at 19:53
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 '13 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
– Frank Nocke
Nov 5 '16 at 6:20
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
– Frank Nocke
Nov 5 '16 at 6:20
Consider using
cp -a
instead.– Pablo Bianchi
Nov 16 '17 at 2:18
Consider using
cp -a
instead.– Pablo Bianchi
Nov 16 '17 at 2:18
add a comment |
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.
– Randall Cook
Dec 8 '12 at 6:50
add a comment |
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.
– Randall Cook
Dec 8 '12 at 6:50
add a comment |
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?
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?
answered Dec 6 '12 at 10:03
david6david6
13.7k43144
13.7k43144
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.
– Randall Cook
Dec 8 '12 at 6:50
add a comment |
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.
– Randall Cook
Dec 8 '12 at 6:50
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.
– Randall Cook
Dec 8 '12 at 6:50
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.
– Randall Cook
Dec 8 '12 at 6:50
add a comment |
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:
- BeyondCompare did not preserve the timestamps of directories
DoubleCommander gave random errors throughout the copying process (no other tool did that; both machines use SSDs and are on the local Wi-Fi)- Midnight Commander lost the timestamps for both files and directories
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).
add a comment |
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:
- BeyondCompare did not preserve the timestamps of directories
DoubleCommander gave random errors throughout the copying process (no other tool did that; both machines use SSDs and are on the local Wi-Fi)- Midnight Commander lost the timestamps for both files and directories
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).
add a comment |
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:
- BeyondCompare did not preserve the timestamps of directories
DoubleCommander gave random errors throughout the copying process (no other tool did that; both machines use SSDs and are on the local Wi-Fi)- Midnight Commander lost the timestamps for both files and directories
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).
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:
- BeyondCompare did not preserve the timestamps of directories
DoubleCommander gave random errors throughout the copying process (no other tool did that; both machines use SSDs and are on the local Wi-Fi)- Midnight Commander lost the timestamps for both files and directories
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).
answered Jan 5 at 12:30
Dan DascalescuDan Dascalescu
1,08421636
1,08421636
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f226033%2fhow-can-i-preserve-file-modification-times-when-copying-to-a-nas%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
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 withcp
,rsync
or any other tool.– Sergey
Dec 6 '12 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 '12 at 10:38