How can I find all files ending in .csv in a given directory using Pharo?
Asked
Active
Viewed 108 times
2
Fuhrmanator
- 9,639
- 6
- 52
- 97
-
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,212
- 12
- 16
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
- 9,639
- 6
- 52
- 97