Task/File/FileMoverTask.php
protected function makeFilenameUnique($dest)
    {
        $fs = new Filesystem();
        $i = 1;
        while ($fs->exists($dest)) {
            if (preg_match('/^(.*?)(-\d+)?(\.[^\.]*)$/', $dest, $matches)) {
                $dest = $matches[1].'-'.$i.$matches[3];
                ++$i;
            } else {
                $dest .= '-'.$i; // Fallback brutal mode
            }
        }

        return $dest;
    }
protected function makeFilenameUnique($dest)
    {
        $fs = new Filesystem();
        $i = 1;
        while ($fs->exists($dest)) {
            if (preg_match('/^(.*?)(-\d+)?(\.[^\.]*)$/', $dest, $matches)) {
                $dest = $matches[1].'-'.$i.$matches[3];
                ++$i;
            } else {
                $dest .= '-'.$i; // Fallback brutal mode
            }
        }

        return $dest;
    }
@param string $dest

@return string