I have a bunch of video files that get generated and placed into daily folders on my PC which are auto created by my NVR and they appear like this with the start time of the motion recording in the file name as well as the end time(created time and modified time).
G:\Reolink\120324\
G:\Reolink\120324\EVC 843A-00-000852-000903.mp4
G:\Reolink\120324\BBQ 833A-00-185854-185901.mp4
G:\Reolink\120324\Doorbell-00-212710-212726.mp4
G:\Reolink\120324\Driveway 1240A-00-232832-232847.mp4
G:\Reolink\120324\Gas Meter 1224A-00-175832-175832.mp4
G:\Reolink\120324\Scaffold 833A-00-174203-174208.mp4
G:\Reolink\120324\Shop 1224A-00-095312-095317.mp4
I can batch rename them like this to appear as I would like..
528 EVC - <datec mm-dd-yy @ hh.mm.ssam/pm - dddd>
528 BBQ - <datec mm-dd-yy @ hh.mm.ssam/pm - dddd>
528 Doorbell - <datec mm-dd-yy @ hh.mm.ssam/pm - dddd>
528 Driveway - <datec mm-dd-yy @ hh.mm.ssam/pm - dddd>
528 Gas Meter - <datec mm-dd-yy @ hh.mm.ssam/pm - dddd>
528 Scaffold - <datec mm-dd-yy @ hh.mm.ssam/pm - dddd>
528 Shop - <datec mm-dd-yy @ hh.mm.ssam/pm - dddd>
But I would prefer to automate it hopefully with CEA > Changing Locations > After painting the file list.
Please advise and if possible, please help with a script.
Thanks
Can CEA "changing locations" be used to rename files that are automatically generated each day?
Re: Can CEA "changing locations" be used to rename files that are automatically generated each day?
Define your minimal $root (subdirs must be somewhere inside of it).
Code: Select all
$root = "G:\Reolink\";
setting "BackgroundFileOps", 0;
if (strpos(<newpath>, $root) != -1) {
$files = listfolder(<newpath>, "*.mp4", 1, <crlf>);
if (!$files) { end true; }
// Files to rename?
$match = regexmatches($files, "^.+?-\d{6}-\d{6}\.[^.]+?$", <crlf>);
if (!$match) { end true; }
foreach($file, $match, <crlf>, "e") {
$cDate = formatdate(property("#date.c", $file), "mm-dd-yy @ hh.mm.ssam/pm - dddd");
$title = "528 " . trim(regexreplace(gpc($file, "base"), "-?\d.+?$")) . " - " . $cDate;
renameitem($title, $file, 1);
}
}
One of my scripts helped you out? Please donate via Paypal
Re: Can CEA "changing locations" be used to rename files that are automatically generated each day?
Works perfect!
Thanks again.
Thanks again.
XYplorer Beta Club