SlackwareThis Forum is for the discussion of Slackware Linux.
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.
Distribution: Xubuntu, Mythbuntu, Lubuntu, Picuntu, Mint 18.1, Debian Jessie
Posts: 1,207
Rep:
how many mp3s?
I want to see how many mp3s I have on my Slackware 11 server. It doesn't have X installed. I've been using df -h for years and that gives an overall view of your mounted partition space. Could I use it to tell me how many mp3 files are on /mnt/mp3?
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,634
Rep:
It can take longer if you have lots of them, but it should do the trick:
find /path/where/to/search -type f -iname "*mp3" | wc -l
EDIT: I just noticed that this probably is not what you are looking for. I interpreted "how many" as the number of mp3s rather than the space they are taking on your harddisk. Should have read better :-|
Last edited by titopoquito; 11-14-2006 at 06:42 AM.
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,634
Rep:
You can cd to /mnt/mp3 and issue "du -h", the last number will give you the overall size of the folder. This won't give you the size of your mp3 files only, if you have other files like cover images etc. saved there too. A quick hack I created out of curiosity:
Code:
find /mnt/mp3 -type f -iname "*mp3" -exec ls -al "{}" \; > ~/mp3-space
cat ~/mp3-test | cut -d" " -f5 > ~/mp3-space2
while read individual; do total=$(($total+$individual)); done < ~/mp3-space2; echo All mp3 files take $total bytes on /mnt/mp3
rm ~/mp3-space ~/mp3-space2
I could bet someone will give you a better script after (s)he has seen my [ironical] simple and elegant [/ironical] script.
Yes. The locate man page describes the '-r' and '-i' switches. But given a sufficiently large database and a sufficiently small and targeted audio file hierarchy, it's possible locate could be slower. Not likely, but just saying...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.