# Searching issue



## Gábor Fülöp (Jan 13, 2016)

Hi everybody!
First up, sorry for my bad English.
I don't found a simply way to collect the Apache errorlog's old directories...
I have FreeBSD 9.1 with Bash.

The Apache error logs are within each domain directory (for the users):

/domains/[domain]/errorlog/[YEAR]/[month]/[day]

I need a command for listing all directory named '2015' or so, for delete in the future.
I don't know what is the right method for searching recursively in the directory structure.
I'm trying this, but it won't work well:

`find /domains - type d ! -newermt 2016-01-01 -name '2015' -print`

This command is listing all directories named '2015' under /domains.
But iI need something like that, searching only in the [domain]/errorlog, rule out the accidental matching for other "-name" directories:

`find /domains/*/errorlog - type d ! -newermt 2016-01-01 -name '2015' -print`
OR
`find /domains - type d ! -newermt 2016-01-01 -name 'errorlog/2015' -print`

Thanks a lot, Regards!

Vas


----------



## Juha Nurmela (Jan 13, 2016)

Shouldn't you use the times from the application, embedded in the pathname ?
`ls -d /domains/*/errorlog/2015`

Juha


----------



## Gábor Fülöp (Jan 14, 2016)

Thanks for the reply!
I don't know what I need to use 
ls is not good, because it gives back the directories contents, by the way it won't works 


```
[root@polymix /home/polymix]# ls -d /domains/*/errorlog/2015
ls: /domains/*/errorlog/2015: No such file or directory
```

I need the directories for delete and recursively...


----------



## ljboiler (Jan 14, 2016)

```
find /domains -type d -path '/domains/*/errorlog/2015' -print
```


----------



## Gábor Fülöp (Jan 14, 2016)

Like a charm!  But why I'm not found that primary in the manual.. arghh
Thank you!


----------

