Spaces:
Runtime error
Runtime error
Update file_utils.py
Browse files- file_utils.py +3 -3
file_utils.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import os
|
| 2 |
from magika import Magika
|
| 3 |
-
import
|
| 4 |
|
| 5 |
def validate_file_types(directory):
|
| 6 |
m = Magika()
|
|
@@ -21,8 +21,8 @@ def validate_file_types(directory):
|
|
| 21 |
|
| 22 |
def get_file_summary(file_path, file_type):
|
| 23 |
size = os.path.getsize(file_path)
|
| 24 |
-
creation_date =
|
| 25 |
-
modification_date =
|
| 26 |
return {
|
| 27 |
"name": os.path.relpath(file_path),
|
| 28 |
"type": file_type,
|
|
|
|
| 1 |
import os
|
| 2 |
from magika import Magika
|
| 3 |
+
import datetime
|
| 4 |
|
| 5 |
def validate_file_types(directory):
|
| 6 |
m = Magika()
|
|
|
|
| 21 |
|
| 22 |
def get_file_summary(file_path, file_type):
|
| 23 |
size = os.path.getsize(file_path)
|
| 24 |
+
creation_date = datetime.datetime.utcfromtimestamp(os.path.getctime(file_path)).strftime('%Y-%m-%d %H:%M:%S UTC')
|
| 25 |
+
modification_date = datetime.datetime.utcfromtimestamp(os.path.getmtime(file_path)).strftime('%Y-%m-%d %H:%M:%S UTC')
|
| 26 |
return {
|
| 27 |
"name": os.path.relpath(file_path),
|
| 28 |
"type": file_type,
|