Reputation: 67
I have several files and folders on different directories which I'm quite positive they have been renamed on those other directories with capitalized letters.
I wanted to be able to find those duplicately named files and folders on the different directories and sort them out so I can see and then track them down afterwards.
Something like:
C:\Program Files\hello.txt
C:\WhateverFolder\heLlo.txt
This would be the output of the program or something similar to that.
You guys think it's possible?
Upvotes: 0
Views: 1069
Reputation: 51613
find /directory | awk '{names[gensub(".*/","","g")]++} END { for (name in names) { if (names[name] > 1) { print name } } }'
Might give you a list of duplicate names (files and folders). That gives you a starting point.
The above assumes gawk
, so here is a more general solution which even supports mixed-case filenames, kudos to mklement0 for the idea:
find /directory | awk -F '/' '{names[tolower($NF)]++} END { for (name in names) { if (names[name]>1) { print name }}}'
Upvotes: 2
Reputation: 207465
If Unix-y commands are too much for you, you can get a listing like this and sort it out yourself maybe?
DIR /B /S /L somefolder
Upvotes: 0