Question Delete duplicates created a particular day

DynV

Distinguished
Aug 13, 2009
280
5
18,785
In a 2 days old directory with a bunch of files & subdirectories, I copied files. It turn out I did the process wrong and I should not have copied anything in that folder. When I learned of the right process I thought it would have attempted to copy the files there (and hopefully ask me what to do with duplicate files and I would have chosen skip) but it did in another folder. So now I'm stuck with plenty of duplicates files and some are large. Both folders should have the same structure but for the 1st folder, the file might have already been there, from 2 days prior.

If possible I'd like for something like the following to happen:
  1. from the R(ight) dir(ectory) find file, check if there's a counterpart in the W(rong) dir
  2. if so, check the creation date of the W version and
    1. if old (2 days older) finish for that file
    2. otherwise (both R & W have same creation date), delete the W counterpart
repeat the 2 steps for all the W files and one it's done delete all empty W folders which have the same creation date as the R counterpart.

The dates don't need to be checked dynamically, I can enter them as I'm running the command or creating the batch file (if batch files have constants, it would be ideal).

I'm not good with Windows CLI, help would be appreciated
 
How many files you're talking about?

By the time you write and debug a script (in constant fear that it will delete the single copy of the file), you can go over these folders, and make decisions.

For some automation: In both folders, execute "dir /s", and use text-compare utility like WinMerge, or import these files into eg Excel, and write some formulaes.
 

DynV

Distinguished
Aug 13, 2009
280
5
18,785
Originally 1,305 Files, 135 Folders. I thought I wouldn't get a reply so went ahead and deleted the largest files, it was probably < 20. The W(rong) folder likely had some of these directories and definitely had some of these files, I don't know how many of each though. It's not a problem if I delete something in the R(ight) directory, it is if I delete something in the W if there wasn't a counterpart or I delete an old file or folder.

I assume I could repeat the process a few times and I'd get the vast majority of the size deleted; but if it's not too complicated I'd like to get everything.
 

TRENDING THREADS