Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have 1000 directories and 5-15 sub directories within them containing mp3 files. I want to make a list of all the songs without their paths. Is it doable?

Or is there a way to obtain the word after the last "\" from the path so that we can retrieve the file-name from it? Some regular expressions or something?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Related: http://stackoverflow.com/questions/5456120/how-to-get-file-only-file-name-with-linux-find

You'll want the find command, and something like this:

find ./ -type f -printf "%f\n"

If you need to filter by file type (for example, if you have other types of files in the folders, such as .jpg cover images, and just want MP3s listed), then tack on the name switch:

find ./ -type f -name "*.mp3" -printf "%f\n"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.