ale wrote:I'm sorry you didn't receive answers yet, maybe as a starting point you can try something like this, but keep in mind I'm not expert like other users and I wrote this right now without much thinking and testing
Code: Select all
sortby;
selfilter "*.cr2|*.xmp";
$list = report("{Name}<crlf>", 1);
regexreplace $filtered, "$list", ".*\.cr2\r\n.*\.xmp\r\n", "";
replace $filtered, "$filtered", "<crlf>", "|";
selfilter "$filtered";
That's actually a pretty decent solution (much smaller and simpler than mine), and assuming you never have orphan cr2 files followed by orphan xmp files it should work fine for the OP.
But it wouldn't work for instance here:
Code: Select all
A.cr2
A.xmp
B.cr2
C.cr2
D.xmp
E.xmp
This is a much more complicated solution which should work all of the time.. but assuming your data set never has orphan cr2 files, you'd be better off using ale's:
Code: Select all
"cr2 & xmp Pairs"
Global($typeA, $typeB);
$typeA = "xmp";
$typeB = "cr2";
Sub("_findOrphans");
"_findOrphans"
Global($typeA, $listA, $typeB, $listB);
//Generate lists for each type.
SelFilter("*.$typeA", "f", "Name");
$listA = GetInfo("SelectedItemsNames", ";");
RegExReplace($listA, $listA, "\.$typeA;", ";");
SelFilter("*.$typeB", "f", "Name");
$listB = GetInfo("SelectedItemsNames", ";");
RegExReplace($listB, $listB, "\.$typeB;", ";");
//Prune listA tokens.
Setting("AllowRecursion", 1);
Global($i);
$i = 1;
Sub("_pruneLoop");
//Prune listB tokens.
$temp = $listA;
$listA = $listB;
$listB = $temp;
$i = 1;
Sub("_pruneLoop");
Setting("AllowRecursion", "r");
//Select the orphan files.
RegexReplace($selListA, $listB, ";", ".$typeA;");
RegexReplace($selListB, $listA, ";", ".$typeB;");
RegexReplace($selectList, "$selListA$selListB", "^;|;$", "");
RegexReplace($selectList, "$selectList", ";+", ";");
SelFilter("$selectList", "f", "Name");
//Display a list of missing files.
RegexReplace($listA, $listA, ";", "<crlf>");
RegexReplace($listB, $listB, ";", "<crlf>");
Text("Missing $typeA file(s) for:<crlf>$listA<crlf><crlf>Missing $typeB file(s) for:<crlf>$listB",,,,"w","<crlf>");
//Look for listA tokens in listB, remove from both if found.
"_pruneLoop"
Global($listA, $listB, $i, $token);
$token = GetToken($listA, $i, ";");
End($token Like "",, 1);
StrPos($idx, $listB, $token);
Sub($idx >= 0 ? "_removeToken" : "_skip");
$i = $i + 1;
Sub("_pruneLoop");
//Remove this token from both lists; adjust i to avoid skipping a token.
"_removeToken"
Global($listA, $listB, $i, $token);
$i = $i - 1;
RegexReplace($listA, $listA, "$token;", "");
RegexReplace($listB, $listB, "$token;", "");
//Do nothing.
"_skip" ;