oqGoYl
October 10, 2020, 5:34pm
1
I want to compare 2 directories, these directory adhere the following criteria:
both directories contain the same directory structure
both directories should contain filenames with the same prefix.
E.g.
First directory contains
Second directory contains
dir1
file1.flac.tags.txt
flle2.flac.tags.txt
dir2
The compare should indicate that dir2/file3.flac.tags.txt is missing.
Can I do this with OPUS?
lxp
October 10, 2020, 6:21pm
2
Yes, with a little script.
The two directories should be source and destination. The script will loop through the source and check for files in the destination.
function OnClick(clickData) {
var cmd = clickData.func.command;
var tab = clickData.func.sourcetab;
var dtab = clickData.func.desttab;
var fsu = DOpus.FSUtil();
var dlg = clickData.func.Dlg();
cmd.deselect = false;
cmd.RunCommand('Set UTILITY=otherlog');
DOpus.ClearOutput();
var srcPath = String(tab.path);
var dstPath = String(dtab.path);
DOpus.Output('Source: ' + srcPath);
DOpus.Output('Destination: ' + dstPath);
if (tab.path.drive == 0 || dtab.path.drive == 0) {
dlg.Request('Please select suitable drives for source and destination!', 'OK');
return;
}
if (srcPath == dstPath) {
dlg.Request('Please select different folders for source and destination!', 'OK');
return;
}
DOpus.Output('\nEnumerating...\n');
var folderEnum = fsu.ReadDir(tab.path, 'r');
while (!folderEnum.complete) {
var item = folderEnum.Next();
if (item.is_dir) continue;
var itemToCheck = String(item.realpath).replace(srcPath, dstPath) + '.tags.txt';
if (fsu.Exists(itemToCheck)) continue;
DOpus.Output(itemToCheck);
}
DOpus.Output('\n... done!');
}
Find Missing Files In Tree.dcf (2.6 KB)
This post explains how to add buttons to toolbars and menus, and also applies to raw commands for things like standalone hotkeys.
For how to use Script Add-Ins, please scroll down to see the post below this one.
Much of this assumes Directory Opus…
4 Likes
oqGoYl
October 10, 2020, 7:08pm
3
Awesome! I appreciate the time and effort you invested in creating this script to help me out. It points me in the good direction, I'm able to adapt the script so it fits my needs. The link to the additional how to was also very helpful. Thanks again lxp
Nice program too Directory Opus!
2 Likes