diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index 8be0ae56699..1662d5cc7a2 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -240,6 +240,10 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, } } closedir($dir); + if ($preserveMtime) { + $mtime = $this->filemtime($source); + $this->touch($target, is_int($mtime) ? $mtime : null); + } return true; } else { $sourceStream = $this->fopen($source, 'r'); @@ -637,6 +641,10 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, $result = $this->copyFromStorage($sourceStorage, $sourceInternalPath . '/' . $file, $targetInternalPath . '/' . $file, $preserveMtime); } } + if ($result && $preserveMtime) { + $mtime = $sourceStorage->filemtime($sourceInternalPath); + $this->touch($targetInternalPath, is_int($mtime) ? $mtime : null); + } } } else { $source = $sourceStorage->fopen($sourceInternalPath, 'r');