LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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 12-09-2012, 04:07 PM   #1
stello1972
LQ Newbie
 
Registered: Dec 2012
Distribution: ubuntu
Posts: 1

Rep: Reputation: Disabled
Find duplicate files within directory tree


I have 2 directories full of e-books and I want to identify any duplicates between Directory A and Directory B.

They are stored like this

Directory A
- Sub-directory = Author name
- Sub-directory = book title
- Sub-directory = book title
- Sub-directory = Author name
.
.
.
Directory B
-Sub-directory = Author name
- Sub-directory = book title
- Sub-directory = book title
- Sub-directory = Author name
.
.
.
etc

The aim is to consolidate the two sources down into one master list.

I'm at a pretty basic level of scripting and need to get this sorted out pretty quick otherwise I'd relish figuring it out myself. Any help will be amazing!

Cheers!
 
Old 12-09-2012, 05:18 PM   #2
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,197

Rep: Reputation: 642Reputation: 642Reputation: 642Reputation: 642Reputation: 642Reputation: 642
i would pipe the results of a find command of directory-a into a for loop and check if it finds the same basename in directory-b.
 
Old 12-09-2012, 05:19 PM   #3
cbtshare
Member
 
Registered: Jul 2009
Posts: 569

Rep: Reputation: 42
You can try a simple for loop:

for file in xyz/*
do
[[ -e "abc/$file" ]] && echo "abc/$file"
done
 
  


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
Find Duplicate Files alaios Linux - Software 4 01-30-2011 09:06 PM
Using diff to find new files in a directory tree madpear Programming 2 12-10-2009 11:27 AM
How to find the amd 64 dvd images in the directory tree yeehi Debian 4 11-27-2007 01:56 AM
Purge duplicate files in one directory smudge|lala Linux - General 8 03-30-2006 09:08 PM
duplicate directory tree for only certain file types curmudgeon42 Linux - Software 13 01-22-2005 03:38 PM


All times are GMT -5. The time now is 11:49 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration