Apparently I'm now abusing a new method. I'm investigating the best way to handle a couple tasks...

I have this:

/Users/Spooneybarger/test/
/Users/Spooneybarger/test/x/
/Users/Spooneybarger/test/x/ed.txt
/Users/Spooneybarger/test/ed.txt/
/Users/Spooneybarger/test/ed.txt/file


As I test, I wanted to find anything named ed.txt...

/Users/Spooneybarger/test/x/ed.txt
/Users/Spooneybarger/test/ed.txt/

so i did:

st> file allFilesMatching: '*ed.txt' do: [ :each | each name printNl ]
'/Users/Spooneybarger/test/ed.txt'
'/Users/Spooneybarger/test/x/ed.txt'

which i believe is the only way to get both as its trying to match against

x
x/ed.txt
ed.txt
ed.ext/file

problem

if i add

/Users/Spooneybarger/test/fred.txt

st> file allFilesMatching: '*ed.txt' do: [ :each | each name printNl ]
'/Users/Spooneybarger/test/ed.txt'
'/Users/Spooneybarger/test/fred.txt'
'/Users/Spooneybarger/test/x/ed.txt'

right so there is no way to use allFilesMatching to get every file named ed.txt like this.
not real intuitive...

st> file allFilesMatching: '*ed.txt' do: [ :each | each stripPath = 'ed.txt' ifTrue: [ each name printNl ] ]
'/Users/Spooneybarger/test/ed.txt'
'/Users/Spooneybarger/test/x/ed.txt'

it would seem that the recursive nature of allFilesMatching pretty much demands that pattern is a full regular expression, otherwise, I can't see a real use case for allFilesMatching:do: that isnt quite limited.

With a regex i could still do what it does right now

.*ed.txt

or what i thought it would do

.*/?ed.txt


_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to