How to exclude multiple file extensions in tree?
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
When using the tree command, I'd like to exclude listing *.png
and *.svg
from the output. The problem is that every bracket expansion I try doesn't work. Is it because of how tree processes commandline arguments?
tree -I *.svg,png
tree -I '*.svg,png'
tree -I '*.svg,*.png'
tree -I '*.svg,*.png'
tree -I '*.p,s(v,n}g'
tree -I '*.png'
Specs:
- GNU bash, version 4.4.23
- tree v1.7.0
linux bash terminal tree
add a comment |Â
up vote
2
down vote
favorite
When using the tree command, I'd like to exclude listing *.png
and *.svg
from the output. The problem is that every bracket expansion I try doesn't work. Is it because of how tree processes commandline arguments?
tree -I *.svg,png
tree -I '*.svg,png'
tree -I '*.svg,*.png'
tree -I '*.svg,*.png'
tree -I '*.p,s(v,n}g'
tree -I '*.png'
Specs:
- GNU bash, version 4.4.23
- tree v1.7.0
linux bash terminal tree
@Attie solved this for me in superuser.com/a/1354169/939457 The answer istree -I '*.svg|*.png'
Thank you!
– Hagbard Celine
Aug 31 at 15:40
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
When using the tree command, I'd like to exclude listing *.png
and *.svg
from the output. The problem is that every bracket expansion I try doesn't work. Is it because of how tree processes commandline arguments?
tree -I *.svg,png
tree -I '*.svg,png'
tree -I '*.svg,*.png'
tree -I '*.svg,*.png'
tree -I '*.p,s(v,n}g'
tree -I '*.png'
Specs:
- GNU bash, version 4.4.23
- tree v1.7.0
linux bash terminal tree
When using the tree command, I'd like to exclude listing *.png
and *.svg
from the output. The problem is that every bracket expansion I try doesn't work. Is it because of how tree processes commandline arguments?
tree -I *.svg,png
tree -I '*.svg,png'
tree -I '*.svg,*.png'
tree -I '*.svg,*.png'
tree -I '*.p,s(v,n}g'
tree -I '*.png'
Specs:
- GNU bash, version 4.4.23
- tree v1.7.0
linux bash terminal tree
edited Aug 31 at 15:31
Attie
8,70231935
8,70231935
asked Aug 31 at 15:23
Hagbard Celine
132
132
@Attie solved this for me in superuser.com/a/1354169/939457 The answer istree -I '*.svg|*.png'
Thank you!
– Hagbard Celine
Aug 31 at 15:40
add a comment |Â
@Attie solved this for me in superuser.com/a/1354169/939457 The answer istree -I '*.svg|*.png'
Thank you!
– Hagbard Celine
Aug 31 at 15:40
@Attie solved this for me in superuser.com/a/1354169/939457 The answer is
tree -I '*.svg|*.png'
Thank you!– Hagbard Celine
Aug 31 at 15:40
@Attie solved this for me in superuser.com/a/1354169/939457 The answer is
tree -I '*.svg|*.png'
Thank you!– Hagbard Celine
Aug 31 at 15:40
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
4
down vote
accepted
-I
is the inverse of -P
... the manual gives more information on what is acceptable for the latter:
https://linux.die.net/man/1/tree
-P pattern
List only those files that match the wild-card pattern.
Note: you must use the
-a
option to also consider those files beginning with a dot.
for matching.
Valid wildcard operators are
*
(any zero or more characters),?
(any single character),[...]
(any single character listed between brackets (optional-
(dash) for character range may be used: ex:[A-Z]
), and[^...]
(any single character not listed in brackets) and|
separates alternate patterns.
There's no mention of the shell's brace expansion syntax of a,b
... This expansion is handled by tree
, not bash
.
And unfortunately you can't specify -I
multiple times...
Instead you need to list the full patterns with a pipe (|
) to separate them:
tree -I '*.svg|*.png'
Note the use of single quotes to prevent the shell from expanding the asterisk (*
) or variables (introduced by a dollar - $
).
Note also that it's not even possible to coerce the shell's brace expansion, as shown below:
$ tree -I '*.'svg,png
+ tree -I '*.svg' '*.png'
*.png [error opening dir]
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
-I
is the inverse of -P
... the manual gives more information on what is acceptable for the latter:
https://linux.die.net/man/1/tree
-P pattern
List only those files that match the wild-card pattern.
Note: you must use the
-a
option to also consider those files beginning with a dot.
for matching.
Valid wildcard operators are
*
(any zero or more characters),?
(any single character),[...]
(any single character listed between brackets (optional-
(dash) for character range may be used: ex:[A-Z]
), and[^...]
(any single character not listed in brackets) and|
separates alternate patterns.
There's no mention of the shell's brace expansion syntax of a,b
... This expansion is handled by tree
, not bash
.
And unfortunately you can't specify -I
multiple times...
Instead you need to list the full patterns with a pipe (|
) to separate them:
tree -I '*.svg|*.png'
Note the use of single quotes to prevent the shell from expanding the asterisk (*
) or variables (introduced by a dollar - $
).
Note also that it's not even possible to coerce the shell's brace expansion, as shown below:
$ tree -I '*.'svg,png
+ tree -I '*.svg' '*.png'
*.png [error opening dir]
add a comment |Â
up vote
4
down vote
accepted
-I
is the inverse of -P
... the manual gives more information on what is acceptable for the latter:
https://linux.die.net/man/1/tree
-P pattern
List only those files that match the wild-card pattern.
Note: you must use the
-a
option to also consider those files beginning with a dot.
for matching.
Valid wildcard operators are
*
(any zero or more characters),?
(any single character),[...]
(any single character listed between brackets (optional-
(dash) for character range may be used: ex:[A-Z]
), and[^...]
(any single character not listed in brackets) and|
separates alternate patterns.
There's no mention of the shell's brace expansion syntax of a,b
... This expansion is handled by tree
, not bash
.
And unfortunately you can't specify -I
multiple times...
Instead you need to list the full patterns with a pipe (|
) to separate them:
tree -I '*.svg|*.png'
Note the use of single quotes to prevent the shell from expanding the asterisk (*
) or variables (introduced by a dollar - $
).
Note also that it's not even possible to coerce the shell's brace expansion, as shown below:
$ tree -I '*.'svg,png
+ tree -I '*.svg' '*.png'
*.png [error opening dir]
add a comment |Â
up vote
4
down vote
accepted
up vote
4
down vote
accepted
-I
is the inverse of -P
... the manual gives more information on what is acceptable for the latter:
https://linux.die.net/man/1/tree
-P pattern
List only those files that match the wild-card pattern.
Note: you must use the
-a
option to also consider those files beginning with a dot.
for matching.
Valid wildcard operators are
*
(any zero or more characters),?
(any single character),[...]
(any single character listed between brackets (optional-
(dash) for character range may be used: ex:[A-Z]
), and[^...]
(any single character not listed in brackets) and|
separates alternate patterns.
There's no mention of the shell's brace expansion syntax of a,b
... This expansion is handled by tree
, not bash
.
And unfortunately you can't specify -I
multiple times...
Instead you need to list the full patterns with a pipe (|
) to separate them:
tree -I '*.svg|*.png'
Note the use of single quotes to prevent the shell from expanding the asterisk (*
) or variables (introduced by a dollar - $
).
Note also that it's not even possible to coerce the shell's brace expansion, as shown below:
$ tree -I '*.'svg,png
+ tree -I '*.svg' '*.png'
*.png [error opening dir]
-I
is the inverse of -P
... the manual gives more information on what is acceptable for the latter:
https://linux.die.net/man/1/tree
-P pattern
List only those files that match the wild-card pattern.
Note: you must use the
-a
option to also consider those files beginning with a dot.
for matching.
Valid wildcard operators are
*
(any zero or more characters),?
(any single character),[...]
(any single character listed between brackets (optional-
(dash) for character range may be used: ex:[A-Z]
), and[^...]
(any single character not listed in brackets) and|
separates alternate patterns.
There's no mention of the shell's brace expansion syntax of a,b
... This expansion is handled by tree
, not bash
.
And unfortunately you can't specify -I
multiple times...
Instead you need to list the full patterns with a pipe (|
) to separate them:
tree -I '*.svg|*.png'
Note the use of single quotes to prevent the shell from expanding the asterisk (*
) or variables (introduced by a dollar - $
).
Note also that it's not even possible to coerce the shell's brace expansion, as shown below:
$ tree -I '*.'svg,png
+ tree -I '*.svg' '*.png'
*.png [error opening dir]
edited Aug 31 at 15:36
answered Aug 31 at 15:30
Attie
8,70231935
8,70231935
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1354165%2fhow-to-exclude-multiple-file-extensions-in-tree%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
@Attie solved this for me in superuser.com/a/1354169/939457 The answer is
tree -I '*.svg|*.png'
Thank you!– Hagbard Celine
Aug 31 at 15:40