Searching for files of a particular length

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Andante
Junior Member
Junior Member
Posts: 41
Joined: 2018-01-31, 01:38 UTC

Searching for files of a particular length

Post by *Andante »

I want to find all files in a large directory whose names are greater than ten characters.

You'd think that this would work: ???????????*.*

But for some unknown reason, every file is returned. Huh? Why?

And what should I use instead?
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Re: Searching for files of a particular length

Post by *ts4242 »

Check ☑ Regex option and search for

Code: Select all

.{11,}\.
Andante
Junior Member
Junior Member
Posts: 41
Joined: 2018-01-31, 01:38 UTC

Re: Searching for files of a particular length

Post by *Andante »

Wonderful, ts4242, that works like a charm.

I just now looked at Help for Regex (a feature I'd never used before), and it was very very hard to follow. Do you happen to know if there's a simpler guide to it somewhere? I'd like to be able to create my own expressions using Regex, now that you've shown it to me.

Thanks!
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Re: Searching for files of a particular length

Post by *ts4242 »

Andante wrote: 2018-10-08, 05:11 UTC Do you happen to know if there's a simpler guide to it somewhere?
There are many guides and tutorials out there, i suggest you start with https://regexone.com/
User avatar
Dalai
Power Member
Power Member
Posts: 9365
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Searching for files of a particular length

Post by *Dalai »

It can also be done without regex, e.g. with a plugin like Filename_ChrCount in conjunction with a rule like this:

Code: Select all

Plugin:           | Property:           |OP:| Value:
filename_chrcount | Filename (Chrcount) | > | 10
on the Plugins tab in TC's search.

To do so: install the plugin (double-click, Enter), then open TC's search, switch to Plugins tab and set the values to the above.

HTH

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Andante
Junior Member
Junior Member
Posts: 41
Joined: 2018-01-31, 01:38 UTC

Re: Searching for files of a particular length

Post by *Andante »

*Great* tutorial, ts4242, thanks. Have been studying it.

So tell me. Is there any difference between these two?
(a|b|c)
[abc]
User avatar
obeg
Junior Member
Junior Member
Posts: 43
Joined: 2006-09-28, 09:20 UTC
Location: Sweden

Re: Searching for files of a particular length

Post by *obeg »

There is no difference when it comes to matching, they will produce the same results.

But the first one will remember the match and it is possible to use in a replace.

If you want to look at from a textual description it is
a OR b OR c
one of the following, a or b or c
User avatar
Stefan2
Power Member
Power Member
Posts: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Searching for files of a particular length

Post by *Stefan2 »

The difference comes with other than such simple examples:

(abc|def|ghi) > match on 'abc' or 'def' or...
[abcdefghi] same as [a-i] >> match on any of that 'a' or 'b' or...


And (||) groups the query:
ab|c|d >>> match 'ab' or 'c' or...
a(b|c|d) >>> match 'ab' or 'ac' or..


 
Andante
Junior Member
Junior Member
Posts: 41
Joined: 2018-01-31, 01:38 UTC

Re: Searching for files of a particular length

Post by *Andante »

Thanks to everyone for this! I've been studying Regex the past couple of days, and feel like I'm starting to get a handle on it.

Currently, my only place to use it is in TC, but since I'm using that daily, I'll get practice with Regex for sure.

I'm curious why \w includes underscore but no other punctuation mark. There must be some reason for that anomaly!
Post Reply