Skip to content
mikey179 edited this page Nov 8, 2011 · 1 revision

Copy directory structure from file system

Sometimes it is helpful to not build a directory structure from scratch, but to adapt an already existing structure from the file system. Since 0.11.0 vfsStream provides a way to achieve this:

vfsStream::copyFromFileSystem($path, $baseDir, $maxFileSize)

This will take the directory structure starting at $path, and copy it to a virtual vfsStream directory structure, adding it to $baseDir. If $baseDir is not given vfsStream will add the structure to the root directory. Any file permissions are copied as well. File contents will only be copied if they do not exceed $maxFileSize which needs to be given in bytes. If it is not set it defaults to 1,024 KB.