Help with find command: seeking *.log files not under hidden directories.

2006-03-29 Thread Adam Funk
I want to modify the following command

find . -maxdepth $DEPTH -name $.log -ok rm '{}' ';';

so that it doesn't look in directories or subdirectories that start
with a . -- any suggestions?

-- 
Thanks,
Adam


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Help with find command: seeking *.log files not under hidden directories.

2006-03-29 Thread Florian Kulzer

Adam Funk wrote:

I want to modify the following command

find . -maxdepth $DEPTH -name $.log -ok rm '{}' ';';

so that it doesn't look in directories or subdirectories that start
with a . -- any suggestions?


You could try -regex instead of -name, e.g.

find . -regex \./[^.].*\.log

lists all files ending in .log except the ones in subdirectories which
start with a dot. I don't know for sure if this also stops find from
descending into such directories at all; I assume this is what you want
to achieve in order to save time. Might be worth a try.

Regards,
Florian


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]




Re: Help with find command: seeking *.log files not under hidden directories.

2006-03-29 Thread Adam Funk
On 2006-03-29, Florian Kulzer [EMAIL PROTECTED] wrote:

 find . -maxdepth $DEPTH -name $.log -ok rm '{}' ';';

$.log was of course a type for *.log.

 so that it doesn't look in directories or subdirectories that start
 with a . -- any suggestions?

 You could try -regex instead of -name, e.g.

 find . -regex \./[^.].*\.log

Perfect!

 lists all files ending in .log except the ones in subdirectories which
 start with a dot. I don't know for sure if this also stops find from
 descending into such directories at all; I assume this is what you want
 to achieve in order to save time. Might be worth a try.

Using the -maxdepth option seems to keep it reasonable.  

Thanks,
Adam


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]