Jul-15-2017, 09:34 AM
If you have to check the file in subfolders too try/except or if statements are not efficient. Both Windows and Linux are using some kind of indexing/database_like so when you ask for a file you get its location in a matter of seconds. 'find' command in Linux does not index or keep info about anything. It's slow too. 'locate' does. If this is the case it's better to use subprocess module.