How to view all files within a folder using openFile?

旧巷老猫 提交于 2019-12-13 03:45:47

问题


I'm using the following code to open a dialog box to a specific folder. It is currently displaying all .jpg files. How do I make it show all files?

path = system.file.openFile('jpg', 'J:\FULLSAIL\Historian')
if path != None:


回答1:


The documentation says that you can specify the file extension, for instance “jpg”.

Since it probably uses glob.glob function to filter the files list, you can try with “*” to have no filtering and get all the files.

The documentation also says that the extension is an optional parameter, so you can try:

system.file.openFile(r”J:\FULLSAIL\Historian”)



回答2:


Ignition's support team said to use the following script.

path = system.file.openFile(None,'J:\FULLSAIL\Historian')

I tested and it seems to work exactly like I was hoping. One note, the term None must be have the first N capitalized, I first tried none and the system did not recognize the cmd. Thank you all for your help.



来源:https://stackoverflow.com/questions/53662197/how-to-view-all-files-within-a-folder-using-openfile

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!