Skip to main content
Tweeted twitter.com/StackUnix/status/709978696841633792
added 10 characters in body; edited tags
Source Link
don_crissti
  • 85.6k
  • 31
  • 234
  • 262

I have large tree, with many pdfpdf files in it. I want to delete the pdfpdf files in this tree, but only those pdfpdf files in sub folders named rules/ There are other type of files inside rules/. The rules/ subfolders have no other subfolders.

For example, I have this tree. Everything below 'source'

  source/
         A/
            rules/*.pdf, *.txt, *.c,etc..
            etc/
         B/
            keep_this.pdf                
            rules/*.pdf
            whatever/
         C/ 
            D/
               rules/*.pdf
               something/

and so on. There are pdfpdf files all over the place, but I only want to delete all the pdfpdf files which are in folders called rules/ and no other place.

I think I need to use

  cd source
  find  / -type d -name "rules"  -print0 | xargs -0 <<<rm *.pdf?? now what?>>>

But I am not sure what to do after getting list of all subfolders named rules/

Any help is appreciated.

On Linux mint.

I have large tree, with many pdf files in it. I want to delete the pdf files in this tree, but only those pdf files in sub folders named rules/ There are other type of files inside rules/. The rules/ subfolders have no other subfolders.

For example, I have this tree. Everything below 'source'

  source/
         A/
            rules/*.pdf, *.txt, *.c,etc..
            etc/
         B/
            keep_this.pdf                
            rules/*.pdf
            whatever/
         C/ 
            D/
               rules/*.pdf
               something/

and so on. There are pdf files all over the place, but I only want to delete all the pdf files which are in folders called rules/ and no other place.

I think I need to use

  cd source
  find  / -type d -name "rules"  -print0 | xargs -0 <<<rm *.pdf?? now what?>>>

But I am not sure what to do after getting list of all subfolders named rules/

Any help is appreciated.

On Linux mint.

I have large tree, with many pdf files in it. I want to delete the pdf files in this tree, but only those pdf files in sub folders named rules/ There are other type of files inside rules/. The rules/ subfolders have no other subfolders.

For example, I have this tree. Everything below 'source'

  source/
         A/
            rules/*.pdf, *.txt, *.c,etc..
            etc/
         B/
            keep_this.pdf                
            rules/*.pdf
            whatever/
         C/ 
            D/
               rules/*.pdf
               something/

and so on. There are pdf files all over the place, but I only want to delete all the pdf files which are in folders called rules/ and no other place.

I think I need to use

  cd source
  find  / -type d -name "rules"  -print0 | xargs -0 <<<rm *.pdf?? now what?>>>

But I am not sure what to do after getting list of all subfolders named rules/

Any help is appreciated.

On Linux mint.

made the question more clear
Source Link
Nasser
  • 991
  • 2
  • 8
  • 12

I have large tree, with many pdf files in it. I want to delete the pdf files in this tree, but only those pdf files in sub folders named rules/ There are other type of files inside rules/. The rules/ subfolders have no other subfolders.

For example, I have this tree. Everything below 'source'

  source/
         A/
            rules/*.pdf, *.txt, *.c,etc..
            etc/
         B/
            keep_this.pdf                
            rules/*.pdf
            whatever/
         C/ 
            D/
               rules/*.pdf
               something/

and so on. There are pdf files all over the place, but I only want to delete all the pdf files which are in folders called rules/ and no other place.

I think I need to use

  cd source
  find  / -type d -name "rules"  -print0 | xargs -0 <<<rm *.pdf?? now what?>>>

But I am not sure what to do after getting list of all subfolders named rules/

Any help is appreciated.

On Linux mint.

I have large tree, with many pdf files in it. I want to delete the pdf files in this tree, but only those pdf files in sub folders named rules/

For example, I have this tree. Everything below 'source'

  source/
         A/
            rules/*.pdf
            etc/
         B/
            keep_this.pdf
            rules/*.pdf
            whatever/
         C/ 
            D/
               rules/*.pdf
               something/

and so on. There are pdf files all over the place, but I only want to delete all the pdf files which are in folders called rules/ and no other place.

I think I need to use

  cd source
  find  / -type d -name "rules"  -print0 | xargs -0 <<<rm *.pdf?? now what?>>>

But I am not sure what to do after getting list of all subfolders named rules/

Any help is appreciated.

On Linux mint.

I have large tree, with many pdf files in it. I want to delete the pdf files in this tree, but only those pdf files in sub folders named rules/ There are other type of files inside rules/. The rules/ subfolders have no other subfolders.

For example, I have this tree. Everything below 'source'

  source/
         A/
            rules/*.pdf, *.txt, *.c,etc..
            etc/
         B/
            keep_this.pdf                
            rules/*.pdf
            whatever/
         C/ 
            D/
               rules/*.pdf
               something/

and so on. There are pdf files all over the place, but I only want to delete all the pdf files which are in folders called rules/ and no other place.

I think I need to use

  cd source
  find  / -type d -name "rules"  -print0 | xargs -0 <<<rm *.pdf?? now what?>>>

But I am not sure what to do after getting list of all subfolders named rules/

Any help is appreciated.

On Linux mint.

typo
Source Link
Nasser
  • 991
  • 2
  • 8
  • 12

I have large tree, with many pdf files in it. I want to delete the pdf files in this tree, but only those pdf files in sub folders named rules/

For example, I have this tree. Everything below 'source'

  source/
         A/
            rules/*.pdf
            etc/
         B/
            keep_this.pdf
            rules/*.pdf
            whatever/
         C/ 
            D/
               rules/*.pdf
               something/

and so on. There are pdf files all over the place, but I only want to delete all the pdf files which are in folders called rules/ and no other place.else.

I think I need to use

  cd source
  find  / -type d -name "rules"  -print0 | xargs -0 <<<rm *.pdf?? now what?>>>

But I am not sure what to do after getting list of all subfolders named rules/

Any help is appreciated.

On Linux mint.

I have large tree, with many pdf files in it. I want to delete the pdf files in this tree, but only those pdf files in sub folders named rules/

For example, I have this tree. Everything below 'source'

  source/
         A/
            rules/*.pdf
            etc/
         B/
            keep_this.pdf
            rules/*.pdf
            whatever/
         C/ 
            D/
               rules/*.pdf
               something/

and so on. There are pdf files all over the place, but I only want to delete all the pdf files which are in folders called rules/ and no other place.else.

I think I need to use

  cd source
  find  / -type d -name "rules"  -print0 | xargs -0 <<<rm *.pdf?? now what?>>>

But I am not sure what to do after getting list of all subfolders named rules/

Any help is appreciated.

On Linux mint.

I have large tree, with many pdf files in it. I want to delete the pdf files in this tree, but only those pdf files in sub folders named rules/

For example, I have this tree. Everything below 'source'

  source/
         A/
            rules/*.pdf
            etc/
         B/
            keep_this.pdf
            rules/*.pdf
            whatever/
         C/ 
            D/
               rules/*.pdf
               something/

and so on. There are pdf files all over the place, but I only want to delete all the pdf files which are in folders called rules/ and no other place.

I think I need to use

  cd source
  find  / -type d -name "rules"  -print0 | xargs -0 <<<rm *.pdf?? now what?>>>

But I am not sure what to do after getting list of all subfolders named rules/

Any help is appreciated.

On Linux mint.

edited title
Link
Nasser
  • 991
  • 2
  • 8
  • 12
Loading
Source Link
Nasser
  • 991
  • 2
  • 8
  • 12
Loading