D. Vasiliev
D. Vasiliev

Reputation: 97

How I can get recursive all directories and files in TYPO3

I use TYPO3 6.2.x I have files folders and subfolders in some directory. I can get all files recursive as

$files = \TYPO3\CMS\Core\Utility\GeneralUtility::getAllFilesAndFoldersInPath(array(), $dirPath, '', 0, 99, '');
$files = \TYPO3\CMS\Core\Utility\GeneralUtility::removePrefixPathFromList($files, $dirPath);  

I get following:

file1
file2
directory1/file1
directory1/file2
directory1/subdirectory/file1

I need to get files and directories as

file1
file2
  directory1    
    file1
    file2
  directory1/subdirectory/
    file1

How I can get recursive all directories and files in it?

Upvotes: 0

Views: 502

Answers (1)

Soren Malling
Soren Malling

Reputation: 522

By using the basename method of PHP

http://php.net/manual/en/function.basename.php

Look at the examples, I think it suits your needs

Upvotes: 0

Related Questions