[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-smalltalk] allFilesMatching:do:
From: |
Sean Allen |
Subject: |
[Help-smalltalk] allFilesMatching:do: |
Date: |
Sat, 10 Jan 2009 10:18:42 -0500 |
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] allFilesMatching:do:,
Sean Allen <=
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Re: [Help-smalltalk] allFilesMatching:do:, Paolo Bonzini, 2009/01/19