How can I find all files ending in .csv
in a given directory using Pharo?
Asked
Active
Viewed 165 times
2

Fuhrmanator
- 11,459
- 6
- 62
- 111
-
Popular in Python, so maybe here, too? https://stackoverflow.com/questions/3964681/find-all-files-in-a-directory-with-extension-txt-in-python – Fuhrmanator Nov 26 '18 at 11:20
2 Answers
4
This will work too:
'G:\My Drive\Data Mining' asFileReference allChildrenMatching: '*.csv'

EstebanLM
- 4,252
- 14
- 17
2
Use basename
and endsWith:
for the children of the directory (FileReference
). From http://pharobooks.gforge.inria.fr/PharoByExampleTwo-Eng/latest/FileSystem.pdf:
working := 'G:\My Drive\Data Mining' asFileReference.
working allChildren select: [ :each | each basename endsWith: '.csv' ]

Fuhrmanator
- 11,459
- 6
- 62
- 111