You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

73 lines
2.0 KiB

<?php
namespace App\Console\Commands;
use App\Services\RenameService;
use function RingCentral\Psr7\str;
use Illuminate\Console\Command;
class RenameTest extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'rename:test {path} {prefix} {level=1}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct() {
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle() {
//
$path = $this->argument("path");
$prefix = $this->argument("prefix");
$level = $this->argument("level");
$rename = new RenameService();
$rename->setNameLevel(intval($level));
// $files = scandir($path);
// foreach ($files as $file) {
// if (str_contains($file, "KID=imgbed,photo&")) {
// $pos = strpos($file, ".jpg");
// $newFileName = substr($file, 0, $pos + 4);
// dump("new filename ". $newFileName);
//
// rename($path . DIRECTORY_SEPARATOR . $file, $path . DIRECTORY_SEPARATOR . $newFileName);
// }
// }
// exit;
// $rename->rename($path, $prefix);
// $arr[0] = 1640486381;
// $arr[1] = 1640553754;
// $arr[2] = 1640488544;
// asort($arr);
// dump($rename->getNameLevel());
// dump($arr);exit;
// $rename->rename($path, $prefix);
// processFirstLevelDirectory($path);exit;
$rename->splitCustomSizeOfFolder($path, $prefix, 500);exit;
// $rename->rename("/Volumes/WD/tmp/写真图/猫九", "猫九-");
return;
$rename->rename("/Volumes/Backup/images/写真/pcBack/3/", "");
// $rename->rename();
// $rename->mvFiles("/Users/shixuesen/Documents/tmp/秀人旗下《MFStar模范学院》套图及视频写真-TLoB/视频/");
}
}