문제

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?

도움이 되었습니까?

해결책

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 }}}'

다른 팁

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top