Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 4 down vote accepted


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


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.