Page 1 of 1

Is there a way to use Bulk Rename Utility to delete duplicat

PostPosted: Fri Feb 14, 2020 3:35 pm
by stevejock1
Not sure if this is the right place to put this, but it's the best I could think of.

Situation: there are five folders called "FolderA" "FolderB" etc etc. Each folder has a folder nested directly "beneath" (not proper parlance, i know, I cant remember) that is also called "FolderA" etc. I want to run a program or script to remove all the duplicate folders. This situation usually is a product of unzipping compressed archives with WinRAR or 7-Zip. I have more than just the five, fyi, try over 500. People need to learn how to compress stuff better.

Re: Is there a way to use Bulk Rename Utility to delete duplicat

PostPosted: Fri Feb 14, 2020 9:31 pm
by bru
Hi, Im not aware of any apps out there that can delete based on such criteria.
If you want to download a small (80kb) commandline app called sed, its very easy to script.
dir/b/s/ad|sed -n -r "/.*\\(.{1,})\\\1$/s/(.*)/rd \/s \/q \x22\1\x22/p"

That would create the following commands for every such matching folder below where you ran it.
rd /s /q "C:\Users\Me\Desktop\aaa\aaa"
rd /s /q "C:\Users\Me\Desktop\abc\xxx\gg\gg"

It will not execute the commands, but it wouldnt take much more to have them auto-deleted.
I hesitate to post anything more.. As a commandline app, nothing goes to the recycle-bin.
If you wanted to keep even one of them, it could spell disaster.. Plenty of forums with sed.
Cheers.