note 113667 added to class.recursivedirectoryiterator

From: Date: Wed, 13 Nov 2013 09:07:17 +0000
Subject: note 113667 added to class.recursivedirectoryiterator
Groups: php.notes 
Request: Send a blank email to php-notes+get-197506@lists.php.net to get a copy of this message
If you want to copy all files recursively from a source directory to some destination : $directory = new RecursiveDirectoryIterator("./source_path/"); foreach (new RecursiveIteratorIterator($directory) as $filename=>$current) { $src = $current->getPathName(); $dest = "./destination_path/" . $current->getFileName(); echo "copy " . $src . " => " . $dest . "\n"; copy($src, $dest); } I hope it can help someone because when I looked for this solution I had to transform another example to get it. ---- Server IP: 72.52.91.14 Probable Submitter: 72.52.91.14 ---- Manual Page -- http://php.net/manual/en/class.recursivedirectoryiterator.php Edit -- https://master.php.net/note/edit/113667 Del: integrated -- https://master.php.net/note/delete/113667/integrated Del: useless -- https://master.php.net/note/delete/113667/useless Del: bad code -- https://master.php.net/note/delete/113667/bad+code Del: spam -- https://master.php.net/note/delete/113667/spam Del: non-english -- https://master.php.net/note/delete/113667/non-english Del: in docs -- https://master.php.net/note/delete/113667/in+docs Del: other reasons-- https://master.php.net/note/delete/113667 Reject -- https://master.php.net/note/reject/113667 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#197506) next »