diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 0f371bbc5eacd2c69cb85c50c68fd684d2e7abe6..ab7a7d3db9abb1db4abd76bff4314fcd26f9202a 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -762,7 +762,9 @@ class View {
 						if (is_resource($dh)) {
 							while (($file = readdir($dh)) !== false) {
 								if (!Filesystem::isIgnoredDir($file)) {
-									$result = $this->copy($path1 . '/' . $file, $path2 . '/' . $file, $preserveMtime);
+									if (!$this->copy($path1 . '/' . $file, $path2 . '/' . $file, $preserveMtime)) {
+										$result = false;
+									}
 								}
 							}
 						}