Created
March 9, 2018 02:57
-
-
Save jaceju/1a5d17aa9d150bf5bc465ac33170da0c to your computer and use it in GitHub Desktop.
Rename files
This file contains hidden or 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 | |
use Illuminate\Support\Str; | |
require __DIR__ . '/vendor/autoload.php'; | |
$fs = new \Illuminate\Filesystem\Filesystem(); | |
$filePaths = $fs->glob(__DIR__ . '/src/Schema/*/Create*.php'); | |
foreach ($filePaths as $filePath) { | |
$file = new SplFileInfo($filePath); | |
$name = $file->getBasename(); | |
$newPath = $file->getPath() . '/2018_03_01_000000_' . Str::snake($name); | |
$fs->move($file->getPathname(), $newPath); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment