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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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/ |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |
![]() |
| Thread Tools | |
| Display Modes | |
|
|