File::touchDirectory
Change the modification time of the files in a directory
Description
public bool File::touchDirectory( string $directory, string $datetime )
Sets the modification time of every file and subdirectory under $directory (recursively) to $datetime, parsed with strtotime(). Symbolic links are skipped.
Returns false when $directory is not a directory, $datetime cannot be parsed or a time could not be changed.
Arguments
| Name | Data type | Default | Remarks |
|---|---|---|---|
| $directory | string | Target directory | |
| $datetime | string | Date and time (any strtotime() format) |
Example
Controller
use Fegg\Tool\File;
$file = new File();
$file->touchDirectory('path/to/foo', '2024-04-01 10:00:00');