Find path that has specific sub directory The Next CEO of Stack OverflowIs it possible to search for a directory/file combination?Recursive find that does not find hidden files or recurse into hidden dirsExclude directory in findFinding a specific file in several sub-directoriesfind path directory in sub directorycopying sub-directories not containing a specific file into another directoryIdentify sub-directories that do not contain a specific string in a specific fileExtract Sub-Directory Path from Partially Known DirectoryFind and delete files, whilst keeping any matching files if in a specific directoryFinding filenames that end in a specific character with or without an extensionFind specific folder path in s3 bucket

Which one is the true statement?

What connection does MS Office have to Netscape Navigator?

Is it professional to write unrelated content in an almost-empty email?

Players Circumventing the limitations of Wish

Point distance program written without a framework

Why is information "lost" when it got into a black hole?

Does the Idaho Potato Commission associate potato skins with healthy eating?

Raspberry pi 3 B with Ubuntu 18.04 server arm64: what chip

What steps are necessary to read a Modern SSD in Medieval Europe?

Would a grinding machine be a simple and workable propulsion system for an interplanetary spacecraft?

how one can write a nice vector parser, something that does pgfvecparseA=B-C; D=E x F;

How did Beeri the Hittite come up with naming his daughter Yehudit?

Does higher Oxidation/ reduction potential translate to higher energy storage in battery?

How to get the last not-null value in an ordered column of a huge table?

Airplane gently rocking its wings during whole flight

What is the process for cleansing a very negative action

What was Carter Burke's job for "the company" in Aliens?

Is it correct to say moon starry nights?

Won the lottery - how do I keep the money?

How do I fit a non linear curve?

If Nick Fury and Coulson already knew about aliens (Kree and Skrull) why did they wait until Thor's appearance to start making weapons?

Film where the government was corrupt with aliens, people sent to kill aliens are given rigged visors not showing the right aliens

Is there a difference between "Fahrstuhl" and "Aufzug"?

Defamation due to breach of confidentiality



Find path that has specific sub directory



The Next CEO of Stack OverflowIs it possible to search for a directory/file combination?Recursive find that does not find hidden files or recurse into hidden dirsExclude directory in findFinding a specific file in several sub-directoriesfind path directory in sub directorycopying sub-directories not containing a specific file into another directoryIdentify sub-directories that do not contain a specific string in a specific fileExtract Sub-Directory Path from Partially Known DirectoryFind and delete files, whilst keeping any matching files if in a specific directoryFinding filenames that end in a specific character with or without an extensionFind specific folder path in s3 bucket










1















Consider path in a directory structure



/A/B/C/D
/A/B/C/E
/A/B/O/P


now if I want to list all path which has sub directory C in it, then can it be done through grep?
Expected output:



/A/B/C/D
/A/B/C/E


I tried using grep and find but could not achieve this.










share|improve this question




























    1















    Consider path in a directory structure



    /A/B/C/D
    /A/B/C/E
    /A/B/O/P


    now if I want to list all path which has sub directory C in it, then can it be done through grep?
    Expected output:



    /A/B/C/D
    /A/B/C/E


    I tried using grep and find but could not achieve this.










    share|improve this question


























      1












      1








      1








      Consider path in a directory structure



      /A/B/C/D
      /A/B/C/E
      /A/B/O/P


      now if I want to list all path which has sub directory C in it, then can it be done through grep?
      Expected output:



      /A/B/C/D
      /A/B/C/E


      I tried using grep and find but could not achieve this.










      share|improve this question
















      Consider path in a directory structure



      /A/B/C/D
      /A/B/C/E
      /A/B/O/P


      now if I want to list all path which has sub directory C in it, then can it be done through grep?
      Expected output:



      /A/B/C/D
      /A/B/C/E


      I tried using grep and find but could not achieve this.







      grep find filter






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 2 days ago









      Jeff Schaller

      44.4k1162143




      44.4k1162143










      asked Feb 4 '17 at 1:04









      user3059993user3059993

      61




      61




















          2 Answers
          2






          active

          oldest

          votes


















          3














          While ka3ak's answer works, find comes with a parameter "-path" so you can simply use



          find . -type d -path "*/c/*"


          -path seems also a bit faster:



          [hexathos:~/test] $ time find . -regextype posix-extended -regex ".*/c/.*"
          ./a/b/c/d
          ./a/b/c/e

          real 0m0,013s
          user 0m0,010s
          sys 0m0,000s
          [hexathos:~/test] $ time find . -type d -path "*/c/*"
          ./a/b/c/d
          ./a/b/c/e

          real 0m0,012s
          user 0m0,007s
          sys 0m0,003s





          share|improve this answer






























            0














            You only need find for this:



            find A -type d -regextype posix-extended -regex ".*/C/.*"


            For the following directory structure



            A 
            └── B
            ├── C
            │   ├── D
            │   └── E
            ├── C1
            │   └── E
            └── O
            └── P


            it would return:



            A/B/C/E
            A/B/C/D





            share|improve this answer

























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "106"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f342392%2ffind-path-that-has-specific-sub-directory%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              3














              While ka3ak's answer works, find comes with a parameter "-path" so you can simply use



              find . -type d -path "*/c/*"


              -path seems also a bit faster:



              [hexathos:~/test] $ time find . -regextype posix-extended -regex ".*/c/.*"
              ./a/b/c/d
              ./a/b/c/e

              real 0m0,013s
              user 0m0,010s
              sys 0m0,000s
              [hexathos:~/test] $ time find . -type d -path "*/c/*"
              ./a/b/c/d
              ./a/b/c/e

              real 0m0,012s
              user 0m0,007s
              sys 0m0,003s





              share|improve this answer



























                3














                While ka3ak's answer works, find comes with a parameter "-path" so you can simply use



                find . -type d -path "*/c/*"


                -path seems also a bit faster:



                [hexathos:~/test] $ time find . -regextype posix-extended -regex ".*/c/.*"
                ./a/b/c/d
                ./a/b/c/e

                real 0m0,013s
                user 0m0,010s
                sys 0m0,000s
                [hexathos:~/test] $ time find . -type d -path "*/c/*"
                ./a/b/c/d
                ./a/b/c/e

                real 0m0,012s
                user 0m0,007s
                sys 0m0,003s





                share|improve this answer

























                  3












                  3








                  3







                  While ka3ak's answer works, find comes with a parameter "-path" so you can simply use



                  find . -type d -path "*/c/*"


                  -path seems also a bit faster:



                  [hexathos:~/test] $ time find . -regextype posix-extended -regex ".*/c/.*"
                  ./a/b/c/d
                  ./a/b/c/e

                  real 0m0,013s
                  user 0m0,010s
                  sys 0m0,000s
                  [hexathos:~/test] $ time find . -type d -path "*/c/*"
                  ./a/b/c/d
                  ./a/b/c/e

                  real 0m0,012s
                  user 0m0,007s
                  sys 0m0,003s





                  share|improve this answer













                  While ka3ak's answer works, find comes with a parameter "-path" so you can simply use



                  find . -type d -path "*/c/*"


                  -path seems also a bit faster:



                  [hexathos:~/test] $ time find . -regextype posix-extended -regex ".*/c/.*"
                  ./a/b/c/d
                  ./a/b/c/e

                  real 0m0,013s
                  user 0m0,010s
                  sys 0m0,000s
                  [hexathos:~/test] $ time find . -type d -path "*/c/*"
                  ./a/b/c/d
                  ./a/b/c/e

                  real 0m0,012s
                  user 0m0,007s
                  sys 0m0,003s






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 4 '17 at 7:28









                  hexathoshexathos

                  313




                  313























                      0














                      You only need find for this:



                      find A -type d -regextype posix-extended -regex ".*/C/.*"


                      For the following directory structure



                      A 
                      └── B
                      ├── C
                      │   ├── D
                      │   └── E
                      ├── C1
                      │   └── E
                      └── O
                      └── P


                      it would return:



                      A/B/C/E
                      A/B/C/D





                      share|improve this answer





























                        0














                        You only need find for this:



                        find A -type d -regextype posix-extended -regex ".*/C/.*"


                        For the following directory structure



                        A 
                        └── B
                        ├── C
                        │   ├── D
                        │   └── E
                        ├── C1
                        │   └── E
                        └── O
                        └── P


                        it would return:



                        A/B/C/E
                        A/B/C/D





                        share|improve this answer



























                          0












                          0








                          0







                          You only need find for this:



                          find A -type d -regextype posix-extended -regex ".*/C/.*"


                          For the following directory structure



                          A 
                          └── B
                          ├── C
                          │   ├── D
                          │   └── E
                          ├── C1
                          │   └── E
                          └── O
                          └── P


                          it would return:



                          A/B/C/E
                          A/B/C/D





                          share|improve this answer















                          You only need find for this:



                          find A -type d -regextype posix-extended -regex ".*/C/.*"


                          For the following directory structure



                          A 
                          └── B
                          ├── C
                          │   ├── D
                          │   └── E
                          ├── C1
                          │   └── E
                          └── O
                          └── P


                          it would return:



                          A/B/C/E
                          A/B/C/D






                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Feb 4 '17 at 9:44

























                          answered Feb 4 '17 at 6:58









                          ka3akka3ak

                          573618




                          573618



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Unix & Linux Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f342392%2ffind-path-that-has-specific-sub-directory%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

                              Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

                              Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.