Find folders contains names+1900-1990+names
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I'm trying to do at search for lots of folders contains ex. Events.1900-1990.events
. I don't want folders ex. with Events.2004
, only folders contains the years from 1900 -> 1990.
The name Event
can be anything, it could be birthdays, wars, etc..
I know I should use regex, but I'm not an expert here :(
I have tried something like this:
find . -type d -regex '*/[a-z][A-Z]/19+[0-9]*' -print
But without finding anything
find regular-expression
add a comment |Â
up vote
0
down vote
favorite
I'm trying to do at search for lots of folders contains ex. Events.1900-1990.events
. I don't want folders ex. with Events.2004
, only folders contains the years from 1900 -> 1990.
The name Event
can be anything, it could be birthdays, wars, etc..
I know I should use regex, but I'm not an expert here :(
I have tried something like this:
find . -type d -regex '*/[a-z][A-Z]/19+[0-9]*' -print
But without finding anything
find regular-expression
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm trying to do at search for lots of folders contains ex. Events.1900-1990.events
. I don't want folders ex. with Events.2004
, only folders contains the years from 1900 -> 1990.
The name Event
can be anything, it could be birthdays, wars, etc..
I know I should use regex, but I'm not an expert here :(
I have tried something like this:
find . -type d -regex '*/[a-z][A-Z]/19+[0-9]*' -print
But without finding anything
find regular-expression
I'm trying to do at search for lots of folders contains ex. Events.1900-1990.events
. I don't want folders ex. with Events.2004
, only folders contains the years from 1900 -> 1990.
The name Event
can be anything, it could be birthdays, wars, etc..
I know I should use regex, but I'm not an expert here :(
I have tried something like this:
find . -type d -regex '*/[a-z][A-Z]/19+[0-9]*' -print
But without finding anything
find regular-expression
find regular-expression
edited Sep 8 at 9:57
Jeff Schaller
33.1k849111
33.1k849111
asked Sep 8 at 8:55
SH1986
264
264
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
find . -type d '(' -name '*19[0-8][0-9]*' -o -name '*1990*' ')'
This would find any directory in or under the current directory whose name contains any of the numbers 1900 through to 1990. The test is split in two on the file name where the first tests for numbers between 1900 and 1989, and the second test is for 1990.
Regular expressions don't need to be used in this case. The patterns above are filename globbing patterns.
If you want to add a test for a filename suffix .events
, then you can do that in two ways:
find . -type d -name '*.events' '(' -name '*19[0-8][0-9]*' -o -name '*1990*' ')'
find . -type d '(' -name '*19[0-8][0-9]*.events' -o -name '*1990*.events' ')'
Your command will not find anything as a *
at the start of a regular expression matches the character *
. You also escape one of the [
in the expression, which makes it match the character [
.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
find . -type d '(' -name '*19[0-8][0-9]*' -o -name '*1990*' ')'
This would find any directory in or under the current directory whose name contains any of the numbers 1900 through to 1990. The test is split in two on the file name where the first tests for numbers between 1900 and 1989, and the second test is for 1990.
Regular expressions don't need to be used in this case. The patterns above are filename globbing patterns.
If you want to add a test for a filename suffix .events
, then you can do that in two ways:
find . -type d -name '*.events' '(' -name '*19[0-8][0-9]*' -o -name '*1990*' ')'
find . -type d '(' -name '*19[0-8][0-9]*.events' -o -name '*1990*.events' ')'
Your command will not find anything as a *
at the start of a regular expression matches the character *
. You also escape one of the [
in the expression, which makes it match the character [
.
add a comment |Â
up vote
1
down vote
accepted
find . -type d '(' -name '*19[0-8][0-9]*' -o -name '*1990*' ')'
This would find any directory in or under the current directory whose name contains any of the numbers 1900 through to 1990. The test is split in two on the file name where the first tests for numbers between 1900 and 1989, and the second test is for 1990.
Regular expressions don't need to be used in this case. The patterns above are filename globbing patterns.
If you want to add a test for a filename suffix .events
, then you can do that in two ways:
find . -type d -name '*.events' '(' -name '*19[0-8][0-9]*' -o -name '*1990*' ')'
find . -type d '(' -name '*19[0-8][0-9]*.events' -o -name '*1990*.events' ')'
Your command will not find anything as a *
at the start of a regular expression matches the character *
. You also escape one of the [
in the expression, which makes it match the character [
.
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
find . -type d '(' -name '*19[0-8][0-9]*' -o -name '*1990*' ')'
This would find any directory in or under the current directory whose name contains any of the numbers 1900 through to 1990. The test is split in two on the file name where the first tests for numbers between 1900 and 1989, and the second test is for 1990.
Regular expressions don't need to be used in this case. The patterns above are filename globbing patterns.
If you want to add a test for a filename suffix .events
, then you can do that in two ways:
find . -type d -name '*.events' '(' -name '*19[0-8][0-9]*' -o -name '*1990*' ')'
find . -type d '(' -name '*19[0-8][0-9]*.events' -o -name '*1990*.events' ')'
Your command will not find anything as a *
at the start of a regular expression matches the character *
. You also escape one of the [
in the expression, which makes it match the character [
.
find . -type d '(' -name '*19[0-8][0-9]*' -o -name '*1990*' ')'
This would find any directory in or under the current directory whose name contains any of the numbers 1900 through to 1990. The test is split in two on the file name where the first tests for numbers between 1900 and 1989, and the second test is for 1990.
Regular expressions don't need to be used in this case. The patterns above are filename globbing patterns.
If you want to add a test for a filename suffix .events
, then you can do that in two ways:
find . -type d -name '*.events' '(' -name '*19[0-8][0-9]*' -o -name '*1990*' ')'
find . -type d '(' -name '*19[0-8][0-9]*.events' -o -name '*1990*.events' ')'
Your command will not find anything as a *
at the start of a regular expression matches the character *
. You also escape one of the [
in the expression, which makes it match the character [
.
edited Sep 8 at 9:30
answered Sep 8 at 9:22
Kusalananda
107k14209331
107k14209331
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%2funix.stackexchange.com%2fquestions%2f467685%2ffind-folders-contains-names1900-1990names%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