This preset renames files to their target properties. Files that don't have this property will be skipped. The target string will be slightly cleaned up for better readability.
// https://resource.dopus.com/t/rename-to-url/49846
// 2024-03-20
function OnGetNewName(getNewNameData) {
var otherMeta = getNewNameData.item.metadata.other;
if (otherMeta.target_type != 'url') return;
var tmp = String(otherMeta.target);
var tmpExt = getNewNameData.newname_ext;
tmp = tmp.replace(/https?:\/\//g, '');
tmp = tmp.replace(/^ww+\./g, '');
tmp = tmp.replace(/\.html?$/g, '');
tmp = tmp.replace(/:/g, '-');
tmp = tmp.replace(/\//g, '-');
tmp = tmp.replace(/\?/g, '');
tmp = tmp.replace(/-+/g, '-');
tmp = tmp.replace(/-$/g, '');
tmp = decodeURIComponent(tmp);
return tmp + tmpExt;
}
Save Rename to URL.orp toββββ
%appdata%\GPSoftware\Directory Opus\Rename Presets