Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('memory_limit', '1024M');
- $source_root = dirname(__FILE__) . "/files/";
- $source_iter =
- new RecursiveIteratorIterator(
- new RecursiveDirectoryIterator($source_root, RecursiveDirectoryIterator::SKIP_DOTS)
- );
- $files_count = iterator_count($source_iter);
- $i = 0;
- $fp = fopen(dirname(__FILE__) . "/files.csv", 'w');
- foreach ($source_iter as $file) {
- if ($file->isFile()) {
- $info['#'] = ++$i;
- $info['filepath'] = $file->getRealPath();
- $info['atime'] = $file->getATime();
- $info['ctime'] = $file->getCTime();
- $info['mtime'] = $file->getMTime();
- $info['perms'] = $file->getPerms();
- $info['size'] = $file->getSize();
- $info['owner'] = $file->getOwner();
- $info['group'] = $file->getGroup();
- $info['hash'] = hash_file('sha256', $file->getRealPath());
- fputcsv($fp, $info, ',', '"');
- echo "$i -> $files_count -> {$info['filepath']} \n";
- }
- }
- fclose($fp);
- ?>
Add Comment
Please, Sign In to add comment