WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Check if file exists (https://forum.worldviz.com/showthread.php?t=3930)

jassel41 09-27-2011 10:55 AM

Check if file exists
 
Is there a way to check if a file exists in the current directory through code?

I don't want to access this file per say, I just want to verify that it already exists in the directory.

Thanks,
Jassel41

farshizzo 09-27-2011 10:58 AM

You can use the os.path.isfile command to check for file existence.
Code:

import os
if os.path.isfile('foo.txt'):
    print 'File exists'


jassel41 09-27-2011 11:22 AM

That's perfect, thank you so much.


All times are GMT -7. The time now is 07:18 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC