Using Find with Regular Expressions.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • techjohnny@gmail.com

    #1

    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
  • Toby A Inkster

    #2
    Re: [OT] Using Find with Regular Expressions.

    techjohnny@gmai l.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

    Comment

    • Baho Utot

      #3
      Re: [OT] Using Find with Regular Expressions.

      On Fri, 07 Mar 2008 11:43:43 +0000, Toby A Inkster 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

      Comment

      • techjohnny@gmail.com

        #4
        Re: Using Find with Regular Expressions.

        On Mar 7, 2:51 pm, Baho Utot <baho-u...@invalid.or gwrote:
        On Fri, 07 Mar 2008 11:43:43 +0000, Toby A Inkster wrote:
        techjoh...@gmai l.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

        Comment

        • Baho Utot

          #5
          Re: Using Find with Regular Expressions.

          On Sat, 08 Mar 2008 02:16:20 -0800, techjohnny@gmai l.com wrote:
          On Mar 7, 2:51 pm, Baho Utot <baho-u...@invalid.or gwrote:
          >On Fri, 07 Mar 2008 11:43:43 +0000, Toby A Inkster wrote:
          techjoh...@gmai l.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

          Comment

          • techjohnny@gmail.com

            #6
            Re: Using Find with Regular Expressions.

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

            Comment

            Working...