Get a filtered list of files in a directory
I am trying to get a list of files in a directory using Python, but I do not want a list of ALL the files.
I am trying to get a list of files in a directory using Python, but I do not want a list of ALL the files.
import os import subprocess proc = subprocess.Popen(['ls','*.bc'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out,err = proc.communicate() print out This script should print all the files with .bc suffix however it returns an empty list. If I do ls *.bc manually in the command line it works. Doing [‘ls’,’test.bc’] inside the script works as well but for some reason the … Read more
I want get a list of filenames with a search pattern with a wildcard. Like: