Path : /proc/3/cwd/var/lib/zabbix/ |
Current File : //proc/3/cwd/var/lib/zabbix/backup_status.py |
#!/usr/bin/python import os import sys import json try: path = sys.argv[1] except IndexError: print "Please provide directory path" sys.exit(1) output = {"data": []} def get_status_files(): try: files = os.listdir(path) except OSError: print "No such file or directory" sys.exit(1) for file in files: output["data"].append({"{#STATUSFILE}": file}) return json.dumps(output) if __name__ == "__main__": print(get_status_files())