Browse Source

To get missing file list

master
venkataakhil 1 year ago
parent
commit
ed676ff723
  1. 22
      smart_service/apis/master_api.py

22
smart_service/apis/master_api.py

@ -429,3 +429,25 @@ def change_file_dir():
return file_data
else:
return "Done"
def file_not_exists():
base_path = os.path.expanduser(
"~") + "/frappe-bench/sites/" + site_name + "/public"
file_data = frappe.db.sql('''
select parent,step_name,file from tabProcedure_Details where content_type = 'File' order by parent; ;''', as_dict=1)
changed_file_list = []
for d in file_data:
path = d['file']
isExist = os.path.exists(base_path + path)
if not isExist:
changed_file_list.append(d)
file_path_not_exists = base_path + "/files/json_files/1.json"
with open(file_path_not_exists, 'w') as outfile:
try:
outfile.write(json.dumps(changed_file_list))
except Exception as e:
pass

Loading…
Cancel
Save