LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-31-2019, 03:34 PM   #1
funkytwig
Member
 
Registered: Jun 2016
Posts: 46

Rep: Reputation: Disabled
list directories where all foles are dumpicated (rmlint)


Hi, I want to scan a filesystem and list any directories which have been duplicated, I want to ignore date/time and ownership. Bu duplicated I mean dave the same files in them.

rmlint looks promising but not sure how to get it to just show a list of duplicated directories. fdfine and fdupes also seem promising but can't quite figure it out.

This is because some users have uploaded directory structures to multiple places but may of done it at different times from different users.
 
Old 03-31-2019, 04:29 PM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,223

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Quote:
Originally Posted by funkytwig View Post
This is because some users have uploaded directory structures to multiple places but may of done it at different times from different users.
First idea I have:

Just list all the directories, and then sort the list by the base directory (the rightmost one) and its parent. Then you do the rest of the checking manually/visually.

Here's a quick Python implementation.
Code:
import os
def sortKey(root):
    ds = root.split('/')
    if len(ds) > 1:
        return '/'.join(ds[-2:])
    return ds[-1]


for root in reversed(sorted((root[0] for root in os.walk('.')), key=sortKey)):
    print(root)

Last edited by dugan; 03-31-2019 at 04:52 PM.
 
Old 03-31-2019, 06:28 PM   #3
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by funkytwig View Post
Bu duplicated I mean dave the same files in them.
Do you mean files with the same name, or the same content, or really identical, i.e. same inode number?
 
Old 03-31-2019, 10:47 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by funkytwig View Post
rmlint looks promising but not sure how to get it to just show a list of duplicated directories.
Have you read the doco ?. I found a section on just this in the tutorial listed on the github homepage.

rmlint is on my list of things to check-out - looks a great addition to the toolset.
 
Old 04-01-2019, 04:29 AM   #5
funkytwig
Member
 
Registered: Jun 2016
Posts: 46

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
Do you mean files with the same name, or the same content, or really identical, i.e. same inode number?
Just the same name and content. Can get a list of duplicated but creating a report of duplicated folders is more tricky. sure I can work it out but will take a while and wondering if someone else has done this.

Seems like a fairly standard usecase.

Ben
 
Old 04-01-2019, 04:30 AM   #6
funkytwig
Member
 
Registered: Jun 2016
Posts: 46

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
Have you read the doco ?. I found a section on just this in the tutorial listed on the github homepage.

rmlint is on my list of things to check-out - looks a great addition to the toolset.
Tried to -D flag but the output was not that useful.

Want something that just tells be directory x is duplicated in directory x (and z)...

Ben
 
Old 04-01-2019, 02:15 PM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
any program will never do what you wish but only what was implemented.

that said you could write yourself a wrapper around the output that formats the output in a desirable manner.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
E: Type 'sudo' is not known on line 1 in source list /etc/apt/sources.list.d/mono-official.list 221B Linux - Newbie 6 09-07-2017 12:14 PM
[SOLVED] How to remove all hidden directories and folders, and only hidden directories and folders rm_-rf_windows Linux - General 5 04-12-2016 07:28 AM
rmlint-2.0.0 - a lint/duplicate finder [rewrite of old rmlint, testers wanted] sahib_bommelig Linux - General 13 10-25-2015 09:55 AM
'E:Malformed line 54 in source list /etc/apt/sources.list (dist parse), E:The list of vsssuccess@gmail.com Linux - Desktop 1 11-17-2010 08:17 AM
Howto? List all files in all directories ordered by size? rusty_turkey Linux - Newbie 2 06-17-2008 07:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:12 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
Open Source Consulting | Domain Registration