Opus 13.18.7 and later give script columns expanded access to both the source and destination. This allows labels to be assigned according to Filter values, which are determined by the results returned from script columns.
The example below shows a script column that compares files in the source with those in the destination, returning either unique, same_name, or same_hash.
In Preferences / Labels / Label Assignments, these three filter labels can be configured to display as red, orange, or green, depending on the script column’s output.
script match DestDupeCheck/DestDupeCheck same_hash
script match DestDupeCheck/DestDupeCheck same_name
script match DestDupeCheck/DestDupeCheck unique
The script column can also be used in a Find filter. Note that the script looks for files directly in the destination and won't dive into subfolders, so be careful when checking Search subfolders.
Toggle the column (optionally) via
Set COLUMNSTOGGLE=scp:DestDupeCheck/DestDupeCheck
and the Label Filters via
Set ENABLELABELFILTER="57366 same_hash",toggle
Set ENABLELABELFILTER="57366 same_name",toggle
Set ENABLELABELFILTER="57366 unique",toggle
JScript
var err = 'error';
var sh = 'same_hash';
var sn = 'same_name';
var un = 'unique';
function OnInit(initData) {
initData.name = 'DestDupeCheck';
initData.version = '2025-10-14';
initData.url = 'https://resource.dopus.com/t/source-to-destination-file-compare/57366/5';
initData.default_enable = true;
initData.min_version = '13.18.7';
}
function OnAddColumns(addColData) {
var col = addColData.AddColumn();
col.name = 'DestDupeCheck';
col.method = 'OnColumn';
col.justify = 'right';
col.match.push_back(err);
col.match.push_back(sh);
col.match.push_back(sn);
col.match.push_back(un);
col.namerefresh = true;
col.autorefresh = 2;
}
function OnColumn(scriptColData) {
scriptColData.value = err;
var item = scriptColData.item;
var tab = scriptColData.tab;
if (!tab) {
// DOpus.Output('no tab:\t' + item);
return;
}
if (!tab.path) {
// DOpus.Output('no tab.path:\t' + item);
return;
}
var dtab = tab.lister.desttab;
if (!dtab) {
// DOpus.Output('no dtab:\t' + item);
return;
}
if (!dtab.path) {
// DOpus.Output('no dtab.path:\t' + item);
return;
}
var fsu = DOpus.FSUtil();
var itemToCheck = fsu.GetItem(dtab.path + '\\' + item.name);
var ret = fsu.Exists(itemToCheck) ? HasSameHash(item, itemToCheck) ? sh : sn : un;
scriptColData.value = ret;
}
function HasSameHash(item, itemToCheck) {
var size1 = String(item.size);
var size2 = String(itemToCheck.size);
if (size1 == '0' && size2 == '0') return true;
if (size1 != size2) return false;
var fsu = DOpus.FSUtil();
var hash1 = fsu.Hash(item, 'md5');
var hash2 = fsu.Hash(itemToCheck, 'md5');
return hash1 == hash2;
}
Save ColumnnDestDupeCheck.js.txt to ↓
%appdata%\GPSoftware\Directory Opus\Script AddIns




