Search for similar folder names

Hello,
I'm in need of searching for folders with exact names that share the same path, but one of them has [Complete] appended to it.
Example:

c:\this\is\my path\photo folder 45\
c:\this\is\my path\photo folder 45 [Complete]\

A result list of any type presenting the results would be nice.

A secondary petition would be the ability to move all contents from regular x folder to the x [Complete] one (and once moved delete the empty x folder)

Enter your starting path or drive in the first line. Once you like the output, remove the comments from the cmd.RunCommand lines.

function OnClick(clickData) {
    var srcPath = DOpus.FSUtil.Resolve('D:\\');
    var cmd = clickData.func.command;
    cmd.RunCommand('Set UTILITY=otherlog');
    cmd.ClearFiles();
    DOpus.ClearOutput;
    var folderEnum = DOpus.FSUtil.ReadDir(srcPath, true); // Recursive
    while (!folderEnum.complete) {
        var folderItem = folderEnum.Next();
        if (folderItem.is_dir) {
            var testFolder1 = folderItem.RealPath;
            var testFolder2 = testFolder1 + ' [Complete]';
            if (DOpus.FSUtil.Exists(testFolder2)) {
                DOpus.Output(testFolder1);
                // cmd.RunCommand('Copy MOVE FILE="' + testFolder1 + '\\*" TO="' + testFolder2 + '"');
                // cmd.RunCommand('Delete FILE="' + testFolder1 + '" NORECYCLE SKIPNOTEMPTY QUIET');
            }
        }
    }
}
2 Likes

You are amazing!!!
I have no words to express my gratitude, it works perfectly and it saves me from tons of hours of manual work.
Thanks lxp!

1 Like