Created
October 10, 2019 02:34
-
-
Save ko31/be94ad6b94a5024e600302d43ccc8080 to your computer and use it in GitHub Desktop.
YYYY/MM/DD/[filename].html というファイルに対して、ディレクトリ構成の年月日からファイル最終更新日時をセット
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* YYYY/MM/DD/[filename].html というファイルに対して、 | |
* ディレクトリ構成の年月日からファイル最終更新日時をセット | |
*/ | |
$paths = glob('*/*/*/*.html'); | |
foreach ($paths as $path) { | |
list($year, $month, $day, $file) = explode('/', $path); | |
touch($path, strtotime(sprintf('%s/%s/%s', $year, $month, $day))); | |
echo "Touched {$path}\n"; | |
} | |
echo "Done\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment