Help with Find command
Hi,
I want to look for files within a bunch of sub dirs below a point in the directory tree that are both jpg and modified within the last 30 days. When I use: find /home/data/pictures/ -mtime -30 I get all files modified in the last 30 days (within all sub dirs under pictures) When I use:find /home/data/pictures/ -name *.jpg I get all jpg files (within all sub dirs under pictures) When I use:find /home/data/pictures/ -name *.jpg -mtime -30 I don't get any files from the sub directories (Only files within the pictures directory) ow can I get all files in the pictures sub directories using both criteria? Ron |
First I would leave off the last upslash in the search directory spec.
/home/data/pictures Second I would put the \ escape character in front of the * wildcard character. Third, your time spec of -30 may be off by one. I believe that it will show the files modified in the last 29 days. Test it out and see. You may have to use -31 to get the files modified in the last 30 days. For example, my .bashrc was modified 11 days ago. Code:
# ls -lah .bashrc AND, I'm not using root to write this. I had a terminal window logged on as root so I used that to do my examples. I'm using a normal user account to do my regular work. :) |
Thanks for the tips - I made the changes, but it only returns files in the pictures directory... I have a bunch of sub-directories under that with files that match my criteria which do not show up.
Any ideas? |
If you have files in the subdirectories that match both criteria then they should be listed. Check to be sure that there really are files that match both criteria in the subdirectories by finding at least one file manually.
|
There really are about 100 files that I downloaded yesterday & show a creation date of 5-15-09...
|
Whoa I GOT IT!
thanks! |
I'm glad I could help, and thank you for posting that you got it figured out. :)
|
All times are GMT -5. The time now is 06:56 PM. |