Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save WordpressDev/7479877 to your computer and use it in GitHub Desktop.

Select an option

Save WordpressDev/7479877 to your computer and use it in GitHub Desktop.
<?php
// Get an array of all files in a directory.
$files = File::files('path_to_dir');
// Get all of the files from the given directory (recursive).
$files = File::allFiles('path_to_dir');
// Get all of the directories within a given directory.
$files = File::directory('path_to_dir');
// Copy a directory from one location to another.
File::copyDirectory('path_to_dir', 'destination');
// Recursively delete a directory.
File::deleteDirectory('path_to_dir');
// Empty a directory of all contents while preserving the directory itself.
File::cleanDirectory('path_to_dir');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment