spmoisa548 commited on
Commit
0211e76
·
verified ·
1 Parent(s): 1c8aa17

Update read_storage.py

Browse files
Files changed (1) hide show
  1. read_storage.py +9 -20
read_storage.py CHANGED
@@ -1,22 +1,11 @@
1
  import os
2
 
3
- STORAGE_PATH = "/data"
4
-
5
- print("=== DIRECTORY TREE ===")
6
- for root, dirs, files in os.walk(STORAGE_PATH):
7
- level = root.replace(STORAGE_PATH, "").count(os.sep)
8
- indent = " " * level
9
- print(f"{indent}{os.path.basename(root) or STORAGE_PATH}/")
10
- for f in files:
11
- print(f"{indent} {f}")
12
-
13
- print("\n=== FILE CONTENTS ===")
14
- for root, dirs, files in os.walk(STORAGE_PATH):
15
- for file in files:
16
- path = os.path.join(root, file)
17
- print(f"\n===== FILE: {path} =====")
18
- try:
19
- with open(path, "r", encoding="utf-8", errors="ignore") as fh:
20
- print(fh.read())
21
- except Exception as e:
22
- print(f"[ERROR] {e}")
 
1
  import os
2
 
3
+ for base in ["/data", "/app", "/home", "/tmp", "/"]:
4
+ print(f"\n=== CHECK {base} ===")
5
+ try:
6
+ for root, dirs, files in os.walk(base):
7
+ for name in files[:5]:
8
+ print(os.path.join(root, name))
9
+ break
10
+ except:
11
+ print("cannot access")