HomePHP File And Directory Manipulation In PHP (part 2)
File And Directory Manipulation In PHP (part 2)
Now that you know the basics of reading and writing files, this second segment of our tutorial on the PHP filesystem API takes you into deeper waters, showing you how to copy, delete and rename files; scan directories; work with uploaded files over HTTP; perform pattern matches on file names; and read and write to processes instead of files.
In the first part of this article, I introduced you to the basic filesystem functions available in PHP, showing you (among other things) how to read and write files on the file system and obtain detailed status information on any file, including data on attributes like file sizes and permissions.
That, however, was just the tip of the iceberg. PHP's filesystem API includes a number of specialized file and directory functions, which let you copy, delete and rename files; scan directories; work with uploaded files over HTTP; perform pattern matches on file names; and read and write to processes instead of files. So keep reading - we've got a long and interesting journey ahead of us!