Index: encfs/DirNode.cpp =================================================================== --- encfs/DirNode.cpp (revision 29) +++ encfs/DirNode.cpp (working copy) @@ -220,6 +220,10 @@ rDebug("renaming %s -> %s", last->oldCName.c_str(), last->newCName.c_str()); + struct stat st; + struct utimbuf ut; + bool preserve_mtime = ::stat(last->oldCName.c_str(), &st) == 0; + // internal node rename.. dn->renameNode( last->oldPName.c_str(), last->newPName.c_str() ); @@ -235,6 +239,12 @@ return false; } + if (preserve_mtime) + { + ut.actime = st.st_atime; + ut.modtime = st.st_mtime; + utime(last->newCName.c_str(), &ut); + } ++last; } @@ -615,9 +625,20 @@ int res = 0; try { + struct stat st; + struct utimbuf ut; + bool preserve_mtime = ::stat(fromCName.c_str(), &st) == 0; + renameNode( fromPlaintext, toPlaintext ); res = ::rename( fromCName.c_str(), toCName.c_str() ); + if (preserve_mtime) + { + ut.actime = st.st_atime; + ut.modtime = st.st_mtime; + utime(toCName.c_str(), &ut); + } + if(res == -1) { // undo