-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample.py
More file actions
30 lines (24 loc) · 1.03 KB
/
example.py
File metadata and controls
30 lines (24 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import everything_tool as et
def search():
try:
with et.Client() as client:
print(f"Everything version: {client.version()}")
print("\nSearching for first 5 '*.py' files, sorted by modified date:")
search_flags = et.Request.FULL_PATH_AND_FILE_NAME | et.Request.SIZE | et.Request.DATE_MODIFIED
results = client.search(
"*.py",
limit=5,
flags=search_flags,
sort=et.Sort.DATE_MODIFIED_DESCENDING
)
for item in results:
size_kb = f"{item.size / 1024:.2f} KB" if item.size is not None else "N/A"
print(f"- Path: {item.full_path}")
print(f" Size: {size_kb}")
print(f" Modified: {item.modified_time}")
except FileNotFoundError:
print("Error: Everything64.dll not found. Please place it in the correct directory.")
except et.SDKError as e:
print(f"An SDK error occurred: {e}")
if __name__ == '__main__':
search()