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 am trying to write a bash script that will automatically unzip mp3 downloads and move them into my ~/music folder.

My problem is that when I use the unzip command, it creates it's own folder within the downloads folder, when I would rather it to just list all the mp3 files in the ~/downloads folder.

My question is if there is a way to have the files listed in the ~/downloads folder instead of creating its own folder within the downloads directory, OR if there is a way to automatically change directories to the resulting unzipped folder assuming I don't know the name of that folder?

Sorry if that sounds confusing, but thanks for any help!

share|improve this question
up vote 6 down vote accepted

Use the unzip -j ("junk paths") option, which will extract just the files without recreating the subdirectories.

share|improve this answer
cool thanks, just what I was looking for. – LurkDog Feb 29 '12 at 23:02
thanks. you can click the tickmark 'accept' next to this answer. – poolie Feb 29 '12 at 23:15

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.