I have a list of files in a directory. I have to process only certain files from that directory. filelist is my desired file-list. How do I go about achieving this? Not interested in a bash solution since I have to do it all in this one Python script. Thanks much!
for record in result: filelist.append(record) print filelist for file in os.listdir(sys.argv.strip() + "/"): for file in filelist: #This doesn't work, how else do I do this? If file equals to my desired file-list, then do something. print file
Sorry guys, not sure how I missed this! Early morning coding I guess!! Mods, please close it unless someone wants to chip in with an efficient way of doing it.
for file in os.listdir(sys.argv.strip() + "/"): if file in filelist: print file