Walk a directory/Recursively: Difference between revisions
Content added Content deleted
m (→{{header|Smalltalk}}: sorted instead of ordered) |
m (→{{header|Smalltalk}}: several bug fixes that prevented the full deep exploration) |
||
Line 466: | Line 466: | ||
cont remove: '.'; remove: '..'. |
cont remove: '.'; remove: '..'. |
||
cont |
cont |
||
do: [ :fn | |
do: [ :n | |fn ps| |
||
ps := (Directory pathSeparator) asString. |
|||
fn := (self name), ps, n. |
|||
((File name: fn) isDirectory) |
((File name: fn) isDirectory) |
||
ifTrue: [ |
ifTrue: [ |
||
twoBlock value: ( |
twoBlock value: (n, ps) value: l. |
||
(Directory name: fn) wholeContent: aPattern withLevel: (l+1) do: twoBlock |
(Directory name: fn) wholeContent: aPattern withLevel: (l+1) do: twoBlock. |
||
] |
] |
||
ifFalse: [ |
ifFalse: [ |
||
( |
( n =~ aPattern ) |
||
ifMatched: [ :m | |
ifMatched: [ :m | |
||
twoBlock value: |
twoBlock value: n value: l |
||
] |
] |
||
] |
] |
||
Line 484: | Line 486: | ||
<lang smalltalk>|d| |
<lang smalltalk>|d| |
||
d := Directory name: '.'. |
d := Directory name: '.'. |
||
d wholeContent: '.st$' do: [ :f :l | |
d wholeContent: '\.st$' do: [ :f :l | |
||
0 to: l do: [ :i | (Character tab) display ]. |
0 to: l do: [ :i | (Character tab) display ]. |
||
f displayNl |
f displayNl |