Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 21 lines (18 sloc) 469 Bytes
#!/usr/bin/python
# (c) Anil Madhavapeddy, Citrix Systems Inc, 2008
# Checks for the existence of a file on a device
import os, sys
import fsimage
if __name__ == "__main__":
if len(sys.argv) != 3:
print "Usage: %s <device> <file>" % sys.argv[0]
sys.exit(2)
device = sys.argv[1]
file = sys.argv[2]
try:
fs = fsimage.open(device, 0)
if fs.file_exists(file):
os._exit(0)
except:
pass
os._exit(1)