$path = '/folder//file.txt'; $normalizedPath = \OC\Files\Filesystem::normalizePath($path); // Returns '/folder/file.txt'
$path = '/folder/../file.txt'; $normalizedPath = \OC\Files\Filesystem::normalizePath($path); // Returns '/file.txt'
$path = 'folder/file.txt'; $normalizedPath = \OC\Files\Filesystem::normalizePath($path); // Returns '/folder/file.txt'This method is part of the ownCloud core PHP library and does not require any additional package library.