Kodi Community Forum
python script to check if a file is present - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: python script to check if a file is present (/showthread.php?tid=227080)



python script to check if a file is present - myfototv - 2015-05-16

Hi everyone,

Big shout out to Enen92 and Curti for the help so far. Cheers Guys!

Ok so I want to write a Python script to check if a Folder Is Present in A directory

Can someone point me in the right direction please,

Thank you.


RE: python script to check if a file is present - Martijn - 2015-05-16

http://mirrors.kodi.tv/docs/python-docs/14.x-helix/xbmcvfs.html#-exists


RE: python script to check if a file is present - ronie - 2015-05-16

you can check if a file or folder exists with our xbmcvfs module:
http://mirrors.xbmc.org/docs/python-docs/14.x-helix/xbmcvfs.html#-exists


RE: python script to check if a file is present - myfototv - 2015-05-16

(2015-05-16, 00:57)Martijn Wrote: http://mirrors.kodi.tv/docs/python-docs/14.x-helix/xbmcvfs.html#-exists

Thanks Martijn,

Im sure I read a blog of yours about making an addon and avoiding mistakes, was that you?? It has a history of code and asciii and utf-8 problems. very interesting.


RE: python script to check if a file is present - myfototv - 2015-05-16

(2015-05-16, 00:59)ronie Wrote: you can check if a file or folder exists with our xbmcvfs module:
http://mirrors.xbmc.org/docs/python-docs/14.x-helix/xbmcvfs.html#-exists

cheers Ronie, Just making dinner. Ill take a look in a short while. Thank you for the quick reply.


RE: python script to check if a file is present - volisizy - 2017-05-21

Here are two examples on hwo to check that a file exists with python 2 and -> https://tutorials.technology/tutorials/08-How-to-check-that-file-exists-with-Python.html


RE: python script to check if a file is present - leneborma - 2020-02-12

python:
import os
dirname = "temp"
#check directory exists
if(os.path.exists(dirname)):
print("Directory Exists")
else:
print("Directory does not exists")

more on...folder exists