I have an Asustor NAS that runs on Linux; I don't know what distro they use.
I'm able to log in it using SSH and use all Shell commands. Internal Volume uses ext2, and external USB HDs use NTFS.
When I try to use
cp command to copy any file around, that file's date metadata is changed to current datetime.
In example, if I use Windows to copy the file from SMB and the file was modified in 2007, the new file is marked as created now in 2017 but modified in 2007. But with Linux
cp command its modified date is changed to 2017 too.
This modified date is very relevant to me because it allows me to sort files on Windows Explore by their modified date. If it's overridden, I'm unable to sort and they all seem to have been created now. I also use modified date to know when I acquired some rare old files.
Is there any parameter I can use in
cp command to preserve original file metadata?
Update: I tried
cp --preserve=timestamps but it didn't work, it printed:
cp: unrecognized option '--preserve=timestamps' BusyBox v1.19.3 (2017-03-22 17:23:49 CST) multi-call binary. Usage: cp [OPTIONS] SOURCE DEST Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY -a Same as -dpR -R,-r Recurse -d,-P Preserve symlinks (default if -R) -L Follow all symlinks -H Follow symlinks on command line -p Preserve file attributes if possible -f Overwrite -i Prompt before overwrite -l,-s Create (sym)links
If I try just
-p it says
cp: can't preserve permissions of '...': Operation not permitted, but as far as I've tested, timestamps are being preserved.