Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I want to list directories recursively but I having trouble with the different file types.
I want the list to group the the extensions together and I'm getting frustrated.
This does what I want, except for grouping them:
Code:
ls -R1
Everything I've tried so far makes a mess.
Which option will do this?
Music directory with mp3, flac and jpg files
I'm trying to get a straight listing so I can actually get rid of duplicates.
None of the programs like fslint, fdupes or shredder [I]can even find duplicates[I] and there's a lot of them - i guess there must be slight differences in the file names (which I can't see) that confuse these programs. (Or are they neurotic about all the details and files must be exact dupes to succeed?)
Looking at about 5000 files here in about 150 directories, and I'm sick of dealing with duplicates.
I need a plain list so I can manually do this without having to go into every freakin' directory one-by-one.
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,814
Rep:
Quote:
Originally Posted by binkyd
Music directory with mp3, flac and jpg files
I'm trying to get a straight listing so I can actually get rid of duplicates.
None of the programs like fslint, fdupes or shredder [I]can even find duplicates[I] and there's a lot of them - i guess there must be slight differences in the file names (which I can't see) that confuse these programs. (Or are they neurotic about all the details and files must be exact dupes to succeed?)
Looking at about 5000 files here in about 150 directories, and I'm sick of dealing with duplicates.
I need a plain list so I can manually do this without having to go into every freakin' directory one-by-one.
I think that finding all the files in your music directory trees and obtaining their checksums would be a much better means of finding true duplicates.
Code:
CSLIST=/tmp/list-of-music-checksums
while read DIR
do
find ${DIR} -type f -exec md5sum {} \; >> ${CSLIST}
done < music-directory.lis
sort < ${CSLIST} > ${CSLIST}.sorted
That'll allow you to find duplicates that, for whatever reason, have different filenames but are actually the same file. You should be able to visually examine the sorted list of checksums+filenames so see the duplicates. If there are a ton of duplicates, you can extract the checksums, sort them and run them through uniq(1) to show the duplicates and use each record of that list to grep the original file containing checksums and filepaths.
If you obtain a list of filenames, you'd still need to obtain information about each file and, say, keep the one with the highest bit rate. If you have a mixture of MP3, Ogg, and FLAC, the inspection gets a [ahem] tad more complicated. Personally, I'd keep anything in FLAC format. Period. Then compare any duplicate MP3s and Oggs to see what bit rate they were encoded with and keep the one with the higher bit rate. If you have an MP3 and an Ogg of the same song and the bit rates are close, maybe give each a listen and see which one sounds "better" to your ears. If they're the same bit rate, I'd keep the Ogg. I once found I had a few duplicates that both sounded "OK" but I ran them through "baudline". That showed pretty clearly that one of them had had a low-pass filter applied while it was encoded. That's the one I tossed.
Personally, I don't get too worked up over a few duplicates. I know that some of the 23,000+ (and growing) music files I have on disk are duplicates but I'm not going to quibble if a song appears in an artist's album-specific subdirectory and also in a greatest hits subdirectory. Sure I'd save a little space by replacing all but one of those with a symbolic link but I'd have to weigh whether it's worth the time tracking them down.
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,814
Rep:
Quote:
Originally Posted by JeremyBoden
Graphical file managers look at the mime-type of a file - this can occasionally include looking at what follows a dot in the name.
A lot of the time they seem to simply throw up their hands and list darned near everything under /usr/bin as a candidate for opening the file. Fortunately for the OP, music files with no file extensions are rare. I was the one that brought up file managers, not the OP so let's reset our focus. :^D
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.