Skip to content

Instantly share code, notes, and snippets.

@driesvints
Last active March 28, 2019 13:52
Show Gist options
  • Save driesvints/6784886 to your computer and use it in GitHub Desktop.
Save driesvints/6784886 to your computer and use it in GitHub Desktop.
Laravel Weekly #25 Quick Tip
<?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