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

Is there a linux command for getting only the files in a folder and inside its subfolders? I have used the find command, but it is displaying all the files and folders. I am executing this shell command using the php exec() function.

share|improve this question

migrated from stackoverflow.com Aug 22 '11 at 12:13

This question came from our site for professional and enthusiast programmers.

up vote 5 down vote accepted

You should use the -type f option to get only files.

find /path_to_find -type f
share|improve this answer
Thanks xdazz.Is their any way to get the files that are modified after a date like 20-08-2011 – THOmas Aug 22 '11 at 6:04
@THOmas: read the man page & search, this is very frequently asked (and answered) – Mat Aug 22 '11 at 6:06
@THOmas: man find. You can use -mtime, or you can use touch to create a file with the time 20110820 and use -newer. – xdazz Aug 22 '11 at 6:14

Your Answer


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