diff --git a/src/File.php b/src/File.php index f8c3a7c..03f9508 100644 --- a/src/File.php +++ b/src/File.php @@ -540,8 +540,17 @@ public function copy($newFile) */ public function move($newRootPathFle) { - $newFile = $this->copy($newRootPathFle); - $this->unlink(); + $newFile = static::object($newRootPathFle); + $newFile->checkAndCreateDir(); + + if (!rename((string) $this->getPath(), (string) $newFile->getPath())) + { + throw new Exception("not move file: " . $this->getPath() . " into: " . $newFile->getPath()); + } + + //Это не правильно! Все зависает на файлах более 10 гб + /*$newFile = $this->copy($newRootPathFle); + $this->unlink();*/ return $newFile; }