LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-02-2010, 03:56 AM   #1
sarew
LQ Newbie
 
Registered: Jul 2010
Posts: 1

Rep: Reputation: 0
duplicate files


How can I find a list of files that are named duplicates i.e. have same name but in different case that exist in the same directory?
 
Old 07-02-2010, 04:18 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Hi and welcome to LinuxQuestions!

From the top-level directory (if you need to descend recursively into a directory tree) you might try:
Code:
find | uniq -id
 
Old 07-02-2010, 04:00 PM   #3
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,078

Rep: Reputation: 195Reputation: 195
Quote:
Originally Posted by colucix View Post
Code:
find | uniq -id
That doesn't produce anything useful when I try it.

I think the first thing to note is that "same name but in different case" is actually something of an oxymoron. If the case is different, they do not have the same name. E.g. hello and HeLLO are two different names.

The closest I've been able to get is this

Code:
mike@continuity:/tmp$ touch hello
mike@continuity:/tmp$ touch HEllO
mike@continuity:/tmp$ touch Hello
mike@continuity:/tmp$ find . -iname \* 2>/dev/null | sort | uniq -id 
./hello
mike@continuity:/tmp$
The output of the find command tells me that there is more than one file with a name that is a variant of hello. But it doesn't tell me that the other files are call. I can find them with another find command though

Code:
mike@continuity:/tmp$ find . -iname hello 2>/dev/null
./HEllO
./Hello
./hello
 
Old 07-02-2010, 04:10 PM   #4
fruttenboel
Member
 
Registered: Jul 2008
Location: Tilburg NL
Distribution: Slackware 14.2 ciurrent, kernel 3.18.11
Posts: 270

Rep: Reputation: 48
Quote:
Originally Posted by sarew View Post
How can I find a list of files that are named duplicates i.e. have same name but in different case that exist in the same directory?
as root run 'updatedb'

when the process is finished, and you are looking for file 'gobbledigook' run

Code:
locate gobbledigook
Done.

updatedb runs as a cron job and executes every day at 10 PM.
 
Old 07-02-2010, 04:40 PM   #5
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,078

Rep: Reputation: 195Reputation: 195
Quote:
Originally Posted by fruttenboel View Post
as root run 'updatedb'
locate, of course! I should have thought of that. It's not installed by default by all distributions. On SUSE distros it's in the package findutils-locate.

Quote:
Originally Posted by fruttenboel View Post
Code:
locate gobbledigook
You need to use the -i option to get a case insensitive search.

Code:
locate -i gobbledigook


Quote:
Originally Posted by fruttenboel View Post
updatedb runs as a cron job and executes every day at 10 PM.
It might run at 10PM on your machine, that doesn't mean it runs at 10PM on all Linux machines. It probably will be run at least once a day, but when it runs will vary depending on the Linux distribution being used.
 
1 members found this post helpful.
Old 07-03-2010, 05:21 AM   #6
fruttenboel
Member
 
Registered: Jul 2008
Location: Tilburg NL
Distribution: Slackware 14.2 ciurrent, kernel 3.18.11
Posts: 270

Rep: Reputation: 48
Quote:
Originally Posted by arizonagroovejet View Post
You need to use the -i option to get a case insensitive search.

Code:
locate -i gobbledigook
Hey thanks for that. I'm using locate so long now that I never came to reading the man pages...

Quote:
It might run at 10PM on your machine, that doesn't mean it runs at 10PM on all Linux machines. It probably will be run at least once a day, but when it runs will vary depending on the Linux distribution being used.
True. I was not completely clear there. On my slackware systems it is installed by default. I put it in crontab to run at 10 PM, that being a time the machine will be running in the majority of times.
 
Old 07-06-2010, 08:40 AM   #7
Baresi
LQ Newbie
 
Registered: Jul 2010
Posts: 2

Rep: Reputation: 0
Smile

<<mod edit: Advertising deleted>>

Last edited by pixellany; 07-06-2010 at 10:29 AM.
 
Old 07-06-2010, 10:30 AM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Baresi;

Do not post advertising links---especially ones advertsing Windows SW!!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
does tar or bzip2 squash duplicate or near-duplicate files? garydale Linux - Software 6 11-19-2009 05:43 PM
deleting duplicate files cs-cam Linux - General 3 11-15-2006 12:27 AM
duplicate files in one folder! hornung Linux - Enterprise 1 01-13-2005 04:35 PM
Duplicate Files and linux carl0ski Linux - Software 1 12-22-2004 05:45 PM


All times are GMT -5. The time now is 08:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration