[Tutor] Checking for the existence of a file on workstations in Windows LAN

Bob Gailer bgailer at alum.rpi.edu
Wed Sep 24 13:18:16 EDT 2003


At 01:54 PM 9/23/2003, R. Alan Monroe wrote:

>I'd like to check client machines on a LAN for the existence of
>certain files, via their C$ share, in a corporate environment.
>
>I can use the os.stat or os.path.exists functions to see whether the
>file is there, but on those times when the functions fail, how do I
>know if it was because the file genuinely didn't exist, or because I
>didn't have rights to their c$ share? I need to distinguish between
>the two cases. Even better would be to distinguish the third case
>where the machine couldn't be found at all, likely because it's
>powered off.

My experience with windows says that even though the API knows where the 
failure was no way will it tell you. I have had numerous occasions where 
knowing the reason for failure would have been very helpful, but the 
information is not available.

I can suggest testing for a known file (e.g. autoexec.bat) to tell whether 
you can see the drive, and using ping to see if the machine is running 
(and, of course, responding to pings, and that the firewall lets you thru, 
etc etc)

Bob Gailer
bgailer at alum.rpi.edu
303 442 2625
-------------- next part --------------

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.506 / Virus Database: 303 - Release Date: 8/1/2003


More information about the Tutor mailing list