Michael C. Adler Michael.Adler at
Sun Oct 3 19:38:14 GMT 1999

I apologize if this has been hashed out before.  I looked in the
archives and didn't find anything.

I've been trying to get robocopy to work from an NT filesystem, copying
to a Unix filesystem using Samba.  I finally figured out why it doesn't

In trans2.c/call_trans2setfilepathinfo(), the code that handles the
SMB_SET_FILE_BASIC_INFO case takes the MAX of the write time and the
changed time.  I believe Microsoft actually uses the changed (creation)
time as the changed time of the file for the purposes of backups.  The
write time is the last time the contents were changed.

robocopy depends on being able to set the last write time.  If it fails,
it doesn't know what to do the next time it is run.  Samba is forcing
the time to be the latter of the write time and the creation time. 
Unfortunately, if a file is copied to a new location on NTFS, the write
time is kept old and the creation time is set new.  This means that it
is very easy to get a file in a state on NTFS such that copying it to a
Samba server will set a relatively new modtime even thought the write
time on NTFS is old.

As an experiment, I changed the modtime computation in
call_trans2setfilepathinfo to use only pdata+16 (write time) and ignore
changed time (pdata+24) when handling SMB_SET_FILE_BASIC_INFO.  I think
this works for me and may be what others want.  I doubt it works for
everyone.  Does it deserve a mode in smb.conf?


More information about the samba-technical mailing list