Maintaining file date when copying across volumes

I am transferring a set of files from Mac to PC. The Mac mounts the PC folder using SMB, so that a folder exists in /Volumes.
The files are copied between the source folder on the Mac, and destination folder on the PC, using FolderItem.CopyFileTo.

The problem is that the file dates are changed to “now” on the PC. If I open the two folders in Finder, and drag/drop a file from Mac to PC, the file date is not changed.

Any ideas about how to best preserve the date? Will using a unix shell command work? What would the exact command line syntax be for a recursive folder copy?

TIA
Tom

It is a “feature” of Windows to give copied files a new creation date. Actually it is an old bug going back all the way to DOS which is so widespread and ingrained that Microsoft never fixed it. Some backup apps use their own copy routines instead of the system one. You can also replace the copy command with a fixed one (not sure how that would be in Win8 or Win10).

You could always change the CreationDate after you copied the file.

Thanks Marcus. I think changing the creation date might be the best idea.

I just did an experiment and used cp -r srcFolder /volumes/dstFolder
And that changes all the dates also

Rsync with flag -t, --times Preserve creation and modification dates and times
Here is a link for rsync rsync info

Loannis, that sounds promising, though I tried it on the command line in OSX and it said “Skipping directory [src]”.
Command was rsync -t src dst

BTW the changing of file modification dates worked, using simple get/set of FolderItem.ModificationDate.

[quote=263498:@Tom Dowad]Loannis, that sounds promising, though I tried it on the command line in OSX and it said “Skipping directory [src]”.
Command was rsync -t src dst

BTW the changing of file modification dates worked, using simple get/set of FolderItem.ModificationDate.[/quote]
The rsync have many options and yes is a bit complicated to work with it.
From the other side the flags from the rsync is so many and for transfer between volumes,servers,folders is the best in my opinion.
Plus that have progress flag to see the copy.if you need future help for rsync i will glad to help you.