Using Find with Regular Expressions.

This is a discussion on Using Find with Regular Expressions. within the PHP Language forums, part of the PHP Programming Forums category; Can somebody help me form a expression with Find to locate -name, but exclude -name. For example, I have a ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-06-2008
techjohnny@gmail.com
 
Posts: n/a
Default Using Find with Regular Expressions.

Can somebody help me form a expression with Find to locate -name, but
exclude -name.

For example, I have a directory that I would like to clean out ever so
ofter, but don't want to touch 3 directories located in the same
directory.

Thanks,

--TJ
Reply With Quote
  #2 (permalink)  
Old 03-07-2008
Toby A Inkster
 
Posts: n/a
Default Re: [OT] Using Find with Regular Expressions.

techjohnny@gmail.com wrote:

> Can somebody help me form a expression with Find to locate -name, but
> exclude -name.


This is off-topic in a PHP newsgroup. Personally, I'd just pipe the output
from "find" through "grep -v".

> For example, I have a directory that I would like to clean out ever so
> ofter, but don't want to touch 3 directories located in the same
> directory.


Why not just cd to the directory and "rm -f *"? Without the "-r", "rm"
doesn't recurse into directories.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 37 days, 17:56.]
[Now Playing: Billy Joel - Captain Jack]

Bottled Water
http://tobyinkster.co.uk/blog/2008/02/18/bottled-water/
Reply With Quote
  #3 (permalink)  
Old 03-07-2008
Baho Utot
 
Posts: n/a
Default Re: [OT] Using Find with Regular Expressions.

On Fri, 07 Mar 2008 11:43:43 +0000, Toby A Inkster wrote:

> techjohnny@gmail.com wrote:


[putolin]

>
>> For example, I have a directory that I would like to clean out ever so
>> ofter, but don't want to touch 3 directories located in the same
>> directory.

>
> Why not just cd to the directory and "rm -f *"? Without the "-r", "rm"
> doesn't recurse into directories.


That would of course be too easy.

--
Tayo'y Mga Pinoy
Reply With Quote
  #4 (permalink)  
Old 03-08-2008
techjohnny@gmail.com
 
Posts: n/a
Default Re: Using Find with Regular Expressions.

On Mar 7, 2:51 pm, Baho Utot <baho-u...@invalid.org> wrote:
> On Fri, 07 Mar 2008 11:43:43 +0000, Toby A Inkster wrote:
> > techjoh...@gmail.com wrote:

>
> [putolin]
>
>
>
> >> For example, I have a directory that I would like to clean out ever so
> >> ofter, but don't want to touch 3 directories located in the same
> >> directory.

>
> > Why not just cd to the directory and "rm -f *"? Without the "-r", "rm"
> > doesn't recurse into directories.

>
> That would of course be too easy.
>
> --
> Tayo'y Mga Pinoy


Let's say there are 50 files and 50 directories, but I only want to
keep 3 or 4 directory and 1 file, now I can do rm -rf to each file and
directory, but I'm looking for a way to more automate this process.

I think applying the +i directory attribute is a solution that works
so far.

Thanks,

--TJ
Reply With Quote
  #5 (permalink)  
Old 03-08-2008
Baho Utot
 
Posts: n/a
Default Re: Using Find with Regular Expressions.

On Sat, 08 Mar 2008 02:16:20 -0800, techjohnny@gmail.com wrote:

> On Mar 7, 2:51 pm, Baho Utot <baho-u...@invalid.org> wrote:
>> On Fri, 07 Mar 2008 11:43:43 +0000, Toby A Inkster wrote:
>> > techjoh...@gmail.com wrote:

>>
>> [putolin]
>>
>>
>>
>> >> For example, I have a directory that I would like to clean out ever
>> >> so ofter, but don't want to touch 3 directories located in the same
>> >> directory.

>>
>> > Why not just cd to the directory and "rm -f *"? Without the "-r",
>> > "rm" doesn't recurse into directories.

>>
>> That would of course be too easy.
>>
>> --
>> Tayo'y Mga Pinoy

>
> Let's say there are 50 files and 50 directories, but I only want to keep
> 3 or 4 directory and 1 file, now I can do rm -rf to each file and
> directory, but I'm looking for a way to more automate this process.
>
> I think applying the +i directory attribute is a solution that works so
> far.
>
> Thanks,
>
> --TJ


*nix or winwoes?

--
Tayo'y Mga Pinoy
Reply With Quote
  #6 (permalink)  
Old 03-09-2008
techjohnny@gmail.com
 
Posts: n/a
Default Re: Using Find with Regular Expressions.

On Mar 8, 5:34 am, Baho Utot <baho-u...@invalid.org> wrote:
> On Sat, 08 Mar 2008 02:16:20 -0800, techjoh...@gmail.com wrote:
> > On Mar 7, 2:51 pm, Baho Utot <baho-u...@invalid.org> wrote:
> >> On Fri, 07 Mar 2008 11:43:43 +0000, Toby A Inkster wrote:
> >> > techjoh...@gmail.com wrote:

>
> >> [putolin]

>
> >> >> For example, I have a directory that I would like to clean out ever
> >> >> so ofter, but don't want to touch 3 directories located in the same
> >> >> directory.

>
> >> > Why not just cd to the directory and "rm -f *"? Without the "-r",
> >> > "rm" doesn't recurse into directories.

>
> >> That would of course be too easy.

>
> >> --
> >> Tayo'y Mga Pinoy

>
> > Let's say there are 50 files and 50 directories, but I only want to keep
> > 3 or 4 directory and 1 file, now I can do rm -rf to each file and
> > directory, but I'm looking for a way to more automate this process.

>
> > I think applying the +i directory attribute is a solution that works so
> > far.

>
> > Thanks,

>
> > --TJ

>
> *nix or winwoes?
>
> --
> Tayo'y Mga Pinoy


*nix
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:00 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0