Is there a way for DO to search for duplicate file but ignore text in brackets? For example, I'd like for DO to consider 3-D Tic-Tac-Toe (Europe).a26 and 3-D Tic-Tac-Toe (USA).a26 to be a duplicate file.
Thanks in advance.
Is there a way for DO to search for duplicate file but ignore text in brackets? For example, I'd like for DO to consider 3-D Tic-Tac-Toe (Europe).a26 and 3-D Tic-Tac-Toe (USA).a26 to be a duplicate file.
Thanks in advance.
That isn't built-in but could be done using a fairly simple script.
If time permits we might be able to make a basic example script.
Would you want it to just look below the current folder, or in a list of several (hardcoded?) folders, or something else?
Is filename the only criteria you want to test against? (Not size, date, contents, etc.)
I think just below the current folder would be OK and yes filename is the only criteria. Thanks for your reply.
I think this should do what you want:
Dupes Special.dcf (5.7 KB)
See How to use buttons and scripts from this forum
(Go to the Button .dcf Files section, if it doesn't jump to it directly).
For reference, here's the script code which is inside the toolbar button:
function OnClick(clickData)
{
// Change this to change the collection name it outputs to.
// It'll add the starting folder name to the end.
// WARNING: Will go haywire if you run the button twice in parallel!
var Collection_Name = "Dupes Special";
var resPath = DOpus.FSUtil.Resolve(clickData.func.sourcetab.path);
Collection_Name += " - " + resPath.filepart;
var cmd = clickData.func.command;
cmd.deselect = false; // Prevent automatic deselection
cmd.ClearFiles();
var mapNamesToVecPaths = DOpus.Create.Map();
// r = Recursive
// l = Skip junctions and symbolic links
var folderEnum = DOpus.FSUtil.ReadDir(resPath, "rl");
while (!folderEnum.complete)
{
var folderItem = folderEnum.Next();
if (folderItem.is_dir)
{
continue; // Skip directories.
}
var name = folderItem.name_stem_m; // Separate stem from extension.
name = name.replace(/^(.+) \(.+\)$/, "$1"); // Remove " (*)" at the end of the stemp.
name += folderItem.ext_m; // Add extension back.
name = name.toUpperCase(); // Uppercase everything so the map ignores case.
// DOpus.Output(name + ' - ' + folderItem);
if (!mapNamesToVecPaths.exists(name))
{
mapNamesToVecPaths(name) = DOpus.Create.Vector();
}
mapNamesToVecPaths(name).push_back(folderItem.realpath);
// DOpus.Output(name + ' = ' + mapNamesToVecPaths(name).count);
}
for (var e = new Enumerator(mapNamesToVecPaths); !e.atEnd(); e.moveNext())
{
var vecPaths = mapNamesToVecPaths(e.item());
if (vecPaths.size > 1)
{
cmd.AddFiles(vecPaths);
}
}
// DOpus.Output(cmd.filecount)
var colPath = 'coll://' + Collection_Name;
// Delete any existing collection.
// Create a new blank collection.
// Add the found items to it.
cmd.AddLine('Delete QUIET FILE="' + colPath + '"');
cmd.AddLine('CreateFolder READAUTO=no NAME="' + colPath + '"');
cmd.AddLine('Go PATH="' + colPath + '" NEWTAB=findexisting');
cmd.Run();
// Now add the found items (if any) to the collection.
// This needs to be done as a separate command to the three above.
if (cmd.filecount > 0)
{
cmd.RunCommand('Copy TO="' + colPath + '" COPYTOCOLL=member');
}
}
Hi Leo, thank you so much for creating that. I will give it a go and report back later.