-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.py
84 lines (51 loc) · 2.02 KB
/
test.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
from datetime import datetime
import os
ts_db = f"{datetime.now().strftime('%Y-%m-%d %H:%M')}"
ts_time = f"{datetime.now().strftime('%H:%M:%S')}"
print(f"\n---------- {ts_time} starting {os.path.basename(__file__)}")
import time
start_time = time.time()
from dotenv import load_dotenv
load_dotenv()
DB_TWITTER = os.getenv("DB_TWITTER")
DB_BTOB = os.getenv("DB_BTOB")
DB_MAILINGEE = os.getenv("DB_MAILINGEE")
import pprint
pp = pprint.PrettyPrinter(indent=4)
####################
# SCRIPT_TITLE
# IMPORTS (script-specific)
import my_utils
from DB.tools import select_all_records, update_record, create_record, delete_record
# GLOBALS
test = 1
verbose = 1
count_row = 0
count_total = 0
count = 0
# FUNCTIONS
# MAIN
# Loop through all files and folders in the directory, including hidden files and folders
path = '/Users/nic/Library/Containers/com.apple.VoiceMemos/Data'
for entry in os.scandir(path):
if entry.is_dir(follow_symlinks=False):
print(entry.path)
elif entry.is_file(follow_symlinks=False):
print(entry.path)
else:
print('Unknown:', entry.path)
########################################################################################################
if __name__ == '__main__':
print('\n\n-------------------------------')
print(f"\ncount_row:\t{count_row:,}")
print(f"count_total:\t{count_total:,}")
print(f"count:\t{count:,}")
run_time = round((time.time() - start_time), 3)
if run_time < 1:
print(f'\n{os.path.basename(__file__)} finished in {round(run_time*1000)}ms at {datetime.now().strftime("%H:%M:%S")}.\n')
elif run_time < 60:
print(f'\n{os.path.basename(__file__)} finished in {round(run_time)}s at {datetime.now().strftime("%H:%M:%S")}.\n')
elif run_time < 3600:
print(f'\n{os.path.basename(__file__)} finished in {round(run_time/60)}mns at {datetime.now().strftime("%H:%M:%S")}.\n')
else:
print(f'\n{os.path.basename(__file__)} finished in {round(run_time/3600, 2)}hrs at {datetime.now().strftime("%H:%M:%S")}.\n')