use Symfony\Component\Filesystem\Filesystem; $filesystem = new Filesystem(); $filesystem->rename('/path/to/old/file.txt', '/path/to/new/file.txt');
use Symfony\Component\Filesystem\Filesystem; $filesystem = new Filesystem(); $filesystem->rename('/path/to/old/directory', '/path/to/new/directory');This code renames the directory "/path/to/old/directory" to "/path/to/new/directory". This method belongs to the symfony/filesystem package.