Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 a bash script /var/www/scripts/process_sounds.sh that uses the command:

find /var/www/unprocessed_sounds/ * -type f

It's supposed to find all the files in the unprocessed_sounds directory, which it does, but it also find all the files in the scripts directory (and then processes them like sound files, which is not what I want).

Why would find return things in the current directory?

share|improve this question
Incidentally, if you actually wanted a wildcard match for something, you could do -name '*', but it only would make sense if it were something other than *. – Random832 Nov 3 '12 at 22:45
up vote 6 down vote accepted

You are writing the command in the wrong way. To search for file in /var/www/unprocessed_sounds/ directory, you should just write like this

find /var/www/unprocessed_sounds/ -type f

Writing like find /var/www/unprocessed_sounds/ * -type f will search for file in /var/www/unprocessed_sounds/ and * which means all directories in current directory also.

share|improve this answer

you have a space in your command

find /var/www/unprocessed_sounds/ * -type f

find is interpreting that you want to look for all files in /var/www/unprocessed_sounds/ AND ./* take the star away (as find will dig into the directory anyway)

share|improve this answer

If you only want to process the files in the /var/www/unprocessed_sounds/ directory, then you don't need to use the * in there.

Try to only use:

find /var/www/unprocessed_sounds/ -type f
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.