in Laravel I'm currently doing things like this: $files = File::allFiles('example/path')
, which then allows me to do things like $file->getCTime()
(in a loop, for example).
Awesome, this is what I want.
But allFiles()
is recursive, so when I try to get the list of all files from a single directory, $files = File::files('example/path')
, it only returns an array of filenames in the directory.
Do I have to new up SplFileInfo::class
every time I want to access the file metadata in the same way as the first method? Wouldn't doing that in an array_walk
, for example, hit performance?
And then there's Storage::class
, I like the idea of disks but it will only give me the lastModified()
date of a file, and not the created date. It also won't let me check if a given path is a directory or not, something that File::isDirectory('example/path)
makes trivial.
Anyway I'm just confused about how I should be talking to my filesystem, since simple things, like getting the date a file was created, or its extension, are turning out to be a lot trickier than I thought.
via gmask