How to remove the date behind a asset filename or prevent add a date behind the filename? I'll have a plugin that's modifies an existing pdf with SETA SIGN. To do so I'm copy the current asset, modify it in the temp folder, unlink original, copy modified file and unlink the temp file. I tried to rename the file (with $rename) but still the date is added behind the filename. I'll found something with avoidFilenameConflicts
but as far as I'll see this is for new assets not for moving or renaming assets.
$assetFilePath = $asset->getVolume()->getRootPath() . DIRECTORY_SEPARATOR . $asset->getPath();
....
unlink($assetFilePath);
copy($tempPath . DIRECTORY_SEPARATOR . $asset->filename, $assetFilePath);
unlink($tempPath . DIRECTORY_SEPARATOR . $asset->filename);
...
$newFileName = 'bla.pdf';
$rename = Craft::$app->assets->moveAsset($asset,$asset->getFolder(),$newFileName);
bla.pdf
becomes bla_2021-03-26-124307.pdf
but I'll want just 'bla.pdf'.