clear multiple directories with rmCreate directories from a list of files with spaces in nameRemove old...

What does `idem` mean in the VIM docs?

What is Weapon Handling?

Why, even after his imprisonment, people keep calling Hannibal Lecter "Doctor"?

Lost passport and visa, tried to reapply, got rejected twice. What are my next steps?

Garage door sticks on a bolt

When did Unix stop storing passwords in clear text?

How to say "respectively" in German when listing (enumerating) things

What does it mean by "my days-of-the-week underwear only go to Thursday" in this context?

Discrepancy regarding AoE point of origin between English and German PHB

Why aren't faces sharp in my f/1.8 portraits even though I'm carefully using center-point autofocus?

Why isn't there armor to protect from spells in the Potterverse?

Why would an airline put 15 passengers at once on standby?

How can the dynamic linker/loader itself be dynamically linked as reported by `file`?

What in my code changed between MacTeX 2017 and MacTex 2019?

French license plates

Why does my browser attempt to download pages from http://clhs.lisp.se instead of viewing them normally?

How to stop the death waves in my city?

What can Thomas Cook customers who have not yet departed do now it has stopped operating?

How life stories turned into Halachot - Mishnaic examples?

Received a package but didn't order it

Can RPi4 run simultaneously on dual band (WiFi 2.4GHz / 5GHz)?

If a spaceship ran out of fuel somewhere in space between Earth and Mars, does it slowly drift off to the Sun?

An impressive body of work

Population of post-Soviet states. Why decreasing?



clear multiple directories with rm


Create directories from a list of files with spaces in nameRemove old directories according to directory's name?Copying Only Directories With FilesCopying directories unrelated file namesrename multiple files in multiple directories using Bash scriptingExtracting data from files in multiple directoriesHow many elements can an array store in unix script?Rename multiple directories using rename command, name involves parenthresisChecking for the existence of multiple directories






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







3















I am trying to clear multiple directories stored in an array. Here's a simplified example (I have more directories).



#!/bin/bash    

$IMAGES_DIR="/Users/michael/scripts/imagefiles"
$BACKUP_DIR="/Users/michael/scripts/imagebackups"

...

array=( $IMAGES_DIR $BACKUP_DIR )
for i in ${array[@]}
do
if [ "$(ls -A $i)" ]; then # check that directory has files in it
rm "$i/"* # remove them
fi
done


I get errors for each directory, e.g.:




rm: /Users/michael/scripts/imagefiles/*: No such file or directory











share|improve this question































    3















    I am trying to clear multiple directories stored in an array. Here's a simplified example (I have more directories).



    #!/bin/bash    

    $IMAGES_DIR="/Users/michael/scripts/imagefiles"
    $BACKUP_DIR="/Users/michael/scripts/imagebackups"

    ...

    array=( $IMAGES_DIR $BACKUP_DIR )
    for i in ${array[@]}
    do
    if [ "$(ls -A $i)" ]; then # check that directory has files in it
    rm "$i/"* # remove them
    fi
    done


    I get errors for each directory, e.g.:




    rm: /Users/michael/scripts/imagefiles/*: No such file or directory











    share|improve this question



























      3












      3








      3








      I am trying to clear multiple directories stored in an array. Here's a simplified example (I have more directories).



      #!/bin/bash    

      $IMAGES_DIR="/Users/michael/scripts/imagefiles"
      $BACKUP_DIR="/Users/michael/scripts/imagebackups"

      ...

      array=( $IMAGES_DIR $BACKUP_DIR )
      for i in ${array[@]}
      do
      if [ "$(ls -A $i)" ]; then # check that directory has files in it
      rm "$i/"* # remove them
      fi
      done


      I get errors for each directory, e.g.:




      rm: /Users/michael/scripts/imagefiles/*: No such file or directory











      share|improve this question














      I am trying to clear multiple directories stored in an array. Here's a simplified example (I have more directories).



      #!/bin/bash    

      $IMAGES_DIR="/Users/michael/scripts/imagefiles"
      $BACKUP_DIR="/Users/michael/scripts/imagebackups"

      ...

      array=( $IMAGES_DIR $BACKUP_DIR )
      for i in ${array[@]}
      do
      if [ "$(ls -A $i)" ]; then # check that directory has files in it
      rm "$i/"* # remove them
      fi
      done


      I get errors for each directory, e.g.:




      rm: /Users/michael/scripts/imagefiles/*: No such file or directory








      bash shell-script shell rm






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 24 '17 at 2:07









      Michael RiordanMichael Riordan

      531 silver badge9 bronze badges




      531 silver badge9 bronze badges

























          4 Answers
          4






          active

          oldest

          votes


















          4
















          How about accomplishing it all in a single command?



          You can capture the file existence check, globbing and removal with one find call. In the case of GNU's version of find we'd have this:



          for f in "${array[@]}"; do
          find "$f" -type f -delete
          done


          If you don't have GNU find use this invocation:



          find "$f" -type f -exec rm -f {} +


          (If instead of clearing files from the entire directory hierarchy you only want to clear files that are immediate children then add -maxdepth 1 before -type f.)



          But wait, there's more....



          As John1024 wisely notes you can forgo the loop altogether by passing the array as the first parameter to find:



               find "${array[@]}" -type f -delete


          That's because: 1) find will accept multiple directories to be searched and processed in one execution 2) the shell will split the array such that each element (directory) becomes an individual positional parameter to find.






          share|improve this answer























          • 1





            Simpler: find "${array[@]}" -type f -delete

            – John1024
            Dec 24 '17 at 3:53






          • 1





            Good one @John1024 ... I shoulda thought of that.

            – B Layer
            Dec 24 '17 at 3:54



















          1
















          Change your code to this:



          #!/bin/bash    

          IMAGES_DIR="/Users/michael/scripts/imagefiles"
          BACKUP_DIR="/Users/michael/scripts/imagebackups"

          array=( $IMAGES_DIR $BACKUP_DIR )
          for i in "${array[@]}"
          do
          if [ "$(ls -A "$i")" ]; then
          rm "${i:?}"/*
          fi
          done


          Errors:




          1. Placing $ on the left hand side of variable assignments

          2. Not quoting the $i in if [ "$(ls -A $i)" ];then

          3. Use "${var:?}" to ensure this, rm "$i/"* never expands to /*






          share|improve this answer




























          • Ok tested on two directories and worked!

            – George Udosen
            Dec 24 '17 at 3:27



















          0
















          If your goal is to remove all files in an array of folders, another alternative would be to pass in the array in rm like so:



          #!/bin/bash    

          $IMAGES_DIR="/Users/michael/scripts/imagefiles"
          $BACKUP_DIR="/Users/michael/scripts/imagebackups"

          ...

          array=( $IMAGES_DIR $BACKUP_DIR )

          # this appends "/*" to the end of each dirname if you want to delete the contents of the directories
          # without deleting the directories themselves
          array=( "${array[@]/%//*}" )

          # this will spread the array into multiple calls to rm
          rm -rf ${array[@]}


          One-liner example:



          rm -rf ${array[@]/%//*}


          But if you want to delete the folders as well, you can just use



          rm -rf ${array[@]}


          One difference to note with B Layer's solution, is that while find will print any errors in finding the paths provided, rm will not in this example.






          share|improve this answer










          New contributor



          JT Houk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





























            -1
















            Please find the below awk oneliner to achieve the same , As tested it worked fine





            i="/root/";ls -ltr /root/| grep "^-rw" | awk -v i="$i" '{print "rm -rvf" " " i$9}' | sh  




            for example i have assigned variable i = path /root/ you can change as per your requirement



            i="/root/" ===> path






            share|improve this answer


























            • See Why you shouldn't parse the output of ls(1)

              – steeldriver
              Dec 24 '17 at 13:58











            • @steeldriver As cross verified from above command I am getting the same result let me know if there is any difference in output

              – Praveen Kumar BS
              Dec 25 '17 at 2:53














            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/4.0/"u003ecc by-sa 4.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%2f412749%2fclear-multiple-directories-with-rm%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            4 Answers
            4






            active

            oldest

            votes








            4 Answers
            4






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            4
















            How about accomplishing it all in a single command?



            You can capture the file existence check, globbing and removal with one find call. In the case of GNU's version of find we'd have this:



            for f in "${array[@]}"; do
            find "$f" -type f -delete
            done


            If you don't have GNU find use this invocation:



            find "$f" -type f -exec rm -f {} +


            (If instead of clearing files from the entire directory hierarchy you only want to clear files that are immediate children then add -maxdepth 1 before -type f.)



            But wait, there's more....



            As John1024 wisely notes you can forgo the loop altogether by passing the array as the first parameter to find:



                 find "${array[@]}" -type f -delete


            That's because: 1) find will accept multiple directories to be searched and processed in one execution 2) the shell will split the array such that each element (directory) becomes an individual positional parameter to find.






            share|improve this answer























            • 1





              Simpler: find "${array[@]}" -type f -delete

              – John1024
              Dec 24 '17 at 3:53






            • 1





              Good one @John1024 ... I shoulda thought of that.

              – B Layer
              Dec 24 '17 at 3:54
















            4
















            How about accomplishing it all in a single command?



            You can capture the file existence check, globbing and removal with one find call. In the case of GNU's version of find we'd have this:



            for f in "${array[@]}"; do
            find "$f" -type f -delete
            done


            If you don't have GNU find use this invocation:



            find "$f" -type f -exec rm -f {} +


            (If instead of clearing files from the entire directory hierarchy you only want to clear files that are immediate children then add -maxdepth 1 before -type f.)



            But wait, there's more....



            As John1024 wisely notes you can forgo the loop altogether by passing the array as the first parameter to find:



                 find "${array[@]}" -type f -delete


            That's because: 1) find will accept multiple directories to be searched and processed in one execution 2) the shell will split the array such that each element (directory) becomes an individual positional parameter to find.






            share|improve this answer























            • 1





              Simpler: find "${array[@]}" -type f -delete

              – John1024
              Dec 24 '17 at 3:53






            • 1





              Good one @John1024 ... I shoulda thought of that.

              – B Layer
              Dec 24 '17 at 3:54














            4














            4










            4









            How about accomplishing it all in a single command?



            You can capture the file existence check, globbing and removal with one find call. In the case of GNU's version of find we'd have this:



            for f in "${array[@]}"; do
            find "$f" -type f -delete
            done


            If you don't have GNU find use this invocation:



            find "$f" -type f -exec rm -f {} +


            (If instead of clearing files from the entire directory hierarchy you only want to clear files that are immediate children then add -maxdepth 1 before -type f.)



            But wait, there's more....



            As John1024 wisely notes you can forgo the loop altogether by passing the array as the first parameter to find:



                 find "${array[@]}" -type f -delete


            That's because: 1) find will accept multiple directories to be searched and processed in one execution 2) the shell will split the array such that each element (directory) becomes an individual positional parameter to find.






            share|improve this answer















            How about accomplishing it all in a single command?



            You can capture the file existence check, globbing and removal with one find call. In the case of GNU's version of find we'd have this:



            for f in "${array[@]}"; do
            find "$f" -type f -delete
            done


            If you don't have GNU find use this invocation:



            find "$f" -type f -exec rm -f {} +


            (If instead of clearing files from the entire directory hierarchy you only want to clear files that are immediate children then add -maxdepth 1 before -type f.)



            But wait, there's more....



            As John1024 wisely notes you can forgo the loop altogether by passing the array as the first parameter to find:



                 find "${array[@]}" -type f -delete


            That's because: 1) find will accept multiple directories to be searched and processed in one execution 2) the shell will split the array such that each element (directory) becomes an individual positional parameter to find.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Dec 24 '17 at 4:36

























            answered Dec 24 '17 at 3:46









            B LayerB Layer

            4,2641 gold badge8 silver badges28 bronze badges




            4,2641 gold badge8 silver badges28 bronze badges











            • 1





              Simpler: find "${array[@]}" -type f -delete

              – John1024
              Dec 24 '17 at 3:53






            • 1





              Good one @John1024 ... I shoulda thought of that.

              – B Layer
              Dec 24 '17 at 3:54














            • 1





              Simpler: find "${array[@]}" -type f -delete

              – John1024
              Dec 24 '17 at 3:53






            • 1





              Good one @John1024 ... I shoulda thought of that.

              – B Layer
              Dec 24 '17 at 3:54








            1




            1





            Simpler: find "${array[@]}" -type f -delete

            – John1024
            Dec 24 '17 at 3:53





            Simpler: find "${array[@]}" -type f -delete

            – John1024
            Dec 24 '17 at 3:53




            1




            1





            Good one @John1024 ... I shoulda thought of that.

            – B Layer
            Dec 24 '17 at 3:54





            Good one @John1024 ... I shoulda thought of that.

            – B Layer
            Dec 24 '17 at 3:54













            1
















            Change your code to this:



            #!/bin/bash    

            IMAGES_DIR="/Users/michael/scripts/imagefiles"
            BACKUP_DIR="/Users/michael/scripts/imagebackups"

            array=( $IMAGES_DIR $BACKUP_DIR )
            for i in "${array[@]}"
            do
            if [ "$(ls -A "$i")" ]; then
            rm "${i:?}"/*
            fi
            done


            Errors:




            1. Placing $ on the left hand side of variable assignments

            2. Not quoting the $i in if [ "$(ls -A $i)" ];then

            3. Use "${var:?}" to ensure this, rm "$i/"* never expands to /*






            share|improve this answer




























            • Ok tested on two directories and worked!

              – George Udosen
              Dec 24 '17 at 3:27
















            1
















            Change your code to this:



            #!/bin/bash    

            IMAGES_DIR="/Users/michael/scripts/imagefiles"
            BACKUP_DIR="/Users/michael/scripts/imagebackups"

            array=( $IMAGES_DIR $BACKUP_DIR )
            for i in "${array[@]}"
            do
            if [ "$(ls -A "$i")" ]; then
            rm "${i:?}"/*
            fi
            done


            Errors:




            1. Placing $ on the left hand side of variable assignments

            2. Not quoting the $i in if [ "$(ls -A $i)" ];then

            3. Use "${var:?}" to ensure this, rm "$i/"* never expands to /*






            share|improve this answer




























            • Ok tested on two directories and worked!

              – George Udosen
              Dec 24 '17 at 3:27














            1














            1










            1









            Change your code to this:



            #!/bin/bash    

            IMAGES_DIR="/Users/michael/scripts/imagefiles"
            BACKUP_DIR="/Users/michael/scripts/imagebackups"

            array=( $IMAGES_DIR $BACKUP_DIR )
            for i in "${array[@]}"
            do
            if [ "$(ls -A "$i")" ]; then
            rm "${i:?}"/*
            fi
            done


            Errors:




            1. Placing $ on the left hand side of variable assignments

            2. Not quoting the $i in if [ "$(ls -A $i)" ];then

            3. Use "${var:?}" to ensure this, rm "$i/"* never expands to /*






            share|improve this answer















            Change your code to this:



            #!/bin/bash    

            IMAGES_DIR="/Users/michael/scripts/imagefiles"
            BACKUP_DIR="/Users/michael/scripts/imagebackups"

            array=( $IMAGES_DIR $BACKUP_DIR )
            for i in "${array[@]}"
            do
            if [ "$(ls -A "$i")" ]; then
            rm "${i:?}"/*
            fi
            done


            Errors:




            1. Placing $ on the left hand side of variable assignments

            2. Not quoting the $i in if [ "$(ls -A $i)" ];then

            3. Use "${var:?}" to ensure this, rm "$i/"* never expands to /*







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Dec 24 '17 at 3:33

























            answered Dec 24 '17 at 2:57









            George UdosenGeorge Udosen

            1,3265 silver badges21 bronze badges




            1,3265 silver badges21 bronze badges
















            • Ok tested on two directories and worked!

              – George Udosen
              Dec 24 '17 at 3:27



















            • Ok tested on two directories and worked!

              – George Udosen
              Dec 24 '17 at 3:27

















            Ok tested on two directories and worked!

            – George Udosen
            Dec 24 '17 at 3:27





            Ok tested on two directories and worked!

            – George Udosen
            Dec 24 '17 at 3:27











            0
















            If your goal is to remove all files in an array of folders, another alternative would be to pass in the array in rm like so:



            #!/bin/bash    

            $IMAGES_DIR="/Users/michael/scripts/imagefiles"
            $BACKUP_DIR="/Users/michael/scripts/imagebackups"

            ...

            array=( $IMAGES_DIR $BACKUP_DIR )

            # this appends "/*" to the end of each dirname if you want to delete the contents of the directories
            # without deleting the directories themselves
            array=( "${array[@]/%//*}" )

            # this will spread the array into multiple calls to rm
            rm -rf ${array[@]}


            One-liner example:



            rm -rf ${array[@]/%//*}


            But if you want to delete the folders as well, you can just use



            rm -rf ${array[@]}


            One difference to note with B Layer's solution, is that while find will print any errors in finding the paths provided, rm will not in this example.






            share|improve this answer










            New contributor



            JT Houk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.


























              0
















              If your goal is to remove all files in an array of folders, another alternative would be to pass in the array in rm like so:



              #!/bin/bash    

              $IMAGES_DIR="/Users/michael/scripts/imagefiles"
              $BACKUP_DIR="/Users/michael/scripts/imagebackups"

              ...

              array=( $IMAGES_DIR $BACKUP_DIR )

              # this appends "/*" to the end of each dirname if you want to delete the contents of the directories
              # without deleting the directories themselves
              array=( "${array[@]/%//*}" )

              # this will spread the array into multiple calls to rm
              rm -rf ${array[@]}


              One-liner example:



              rm -rf ${array[@]/%//*}


              But if you want to delete the folders as well, you can just use



              rm -rf ${array[@]}


              One difference to note with B Layer's solution, is that while find will print any errors in finding the paths provided, rm will not in this example.






              share|improve this answer










              New contributor



              JT Houk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.
























                0














                0










                0









                If your goal is to remove all files in an array of folders, another alternative would be to pass in the array in rm like so:



                #!/bin/bash    

                $IMAGES_DIR="/Users/michael/scripts/imagefiles"
                $BACKUP_DIR="/Users/michael/scripts/imagebackups"

                ...

                array=( $IMAGES_DIR $BACKUP_DIR )

                # this appends "/*" to the end of each dirname if you want to delete the contents of the directories
                # without deleting the directories themselves
                array=( "${array[@]/%//*}" )

                # this will spread the array into multiple calls to rm
                rm -rf ${array[@]}


                One-liner example:



                rm -rf ${array[@]/%//*}


                But if you want to delete the folders as well, you can just use



                rm -rf ${array[@]}


                One difference to note with B Layer's solution, is that while find will print any errors in finding the paths provided, rm will not in this example.






                share|improve this answer










                New contributor



                JT Houk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                If your goal is to remove all files in an array of folders, another alternative would be to pass in the array in rm like so:



                #!/bin/bash    

                $IMAGES_DIR="/Users/michael/scripts/imagefiles"
                $BACKUP_DIR="/Users/michael/scripts/imagebackups"

                ...

                array=( $IMAGES_DIR $BACKUP_DIR )

                # this appends "/*" to the end of each dirname if you want to delete the contents of the directories
                # without deleting the directories themselves
                array=( "${array[@]/%//*}" )

                # this will spread the array into multiple calls to rm
                rm -rf ${array[@]}


                One-liner example:



                rm -rf ${array[@]/%//*}


                But if you want to delete the folders as well, you can just use



                rm -rf ${array[@]}


                One difference to note with B Layer's solution, is that while find will print any errors in finding the paths provided, rm will not in this example.







                share|improve this answer










                New contributor



                JT Houk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.








                share|improve this answer



                share|improve this answer








                edited 12 mins ago





















                New contributor



                JT Houk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.








                answered 18 mins ago









                JT HoukJT Houk

                12 bronze badges




                12 bronze badges




                New contributor



                JT Houk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.




                New contributor




                JT Houk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.




























                    -1
















                    Please find the below awk oneliner to achieve the same , As tested it worked fine





                    i="/root/";ls -ltr /root/| grep "^-rw" | awk -v i="$i" '{print "rm -rvf" " " i$9}' | sh  




                    for example i have assigned variable i = path /root/ you can change as per your requirement



                    i="/root/" ===> path






                    share|improve this answer


























                    • See Why you shouldn't parse the output of ls(1)

                      – steeldriver
                      Dec 24 '17 at 13:58











                    • @steeldriver As cross verified from above command I am getting the same result let me know if there is any difference in output

                      – Praveen Kumar BS
                      Dec 25 '17 at 2:53
















                    -1
















                    Please find the below awk oneliner to achieve the same , As tested it worked fine





                    i="/root/";ls -ltr /root/| grep "^-rw" | awk -v i="$i" '{print "rm -rvf" " " i$9}' | sh  




                    for example i have assigned variable i = path /root/ you can change as per your requirement



                    i="/root/" ===> path






                    share|improve this answer


























                    • See Why you shouldn't parse the output of ls(1)

                      – steeldriver
                      Dec 24 '17 at 13:58











                    • @steeldriver As cross verified from above command I am getting the same result let me know if there is any difference in output

                      – Praveen Kumar BS
                      Dec 25 '17 at 2:53














                    -1














                    -1










                    -1









                    Please find the below awk oneliner to achieve the same , As tested it worked fine





                    i="/root/";ls -ltr /root/| grep "^-rw" | awk -v i="$i" '{print "rm -rvf" " " i$9}' | sh  




                    for example i have assigned variable i = path /root/ you can change as per your requirement



                    i="/root/" ===> path






                    share|improve this answer













                    Please find the below awk oneliner to achieve the same , As tested it worked fine





                    i="/root/";ls -ltr /root/| grep "^-rw" | awk -v i="$i" '{print "rm -rvf" " " i$9}' | sh  




                    for example i have assigned variable i = path /root/ you can change as per your requirement



                    i="/root/" ===> path







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Dec 24 '17 at 7:56









                    Praveen Kumar BSPraveen Kumar BS

                    2,4122 gold badges3 silver badges11 bronze badges




                    2,4122 gold badges3 silver badges11 bronze badges
















                    • See Why you shouldn't parse the output of ls(1)

                      – steeldriver
                      Dec 24 '17 at 13:58











                    • @steeldriver As cross verified from above command I am getting the same result let me know if there is any difference in output

                      – Praveen Kumar BS
                      Dec 25 '17 at 2:53



















                    • See Why you shouldn't parse the output of ls(1)

                      – steeldriver
                      Dec 24 '17 at 13:58











                    • @steeldriver As cross verified from above command I am getting the same result let me know if there is any difference in output

                      – Praveen Kumar BS
                      Dec 25 '17 at 2:53

















                    See Why you shouldn't parse the output of ls(1)

                    – steeldriver
                    Dec 24 '17 at 13:58





                    See Why you shouldn't parse the output of ls(1)

                    – steeldriver
                    Dec 24 '17 at 13:58













                    @steeldriver As cross verified from above command I am getting the same result let me know if there is any difference in output

                    – Praveen Kumar BS
                    Dec 25 '17 at 2:53





                    @steeldriver As cross verified from above command I am getting the same result let me know if there is any difference in output

                    – Praveen Kumar BS
                    Dec 25 '17 at 2:53



















                    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%2f412749%2fclear-multiple-directories-with-rm%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

                    Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

                    Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

                    Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...