Add in def to check if an existing file modified and then generatename plus new
This commit is contained in:
parent
5fc9f9b763
commit
1811a52dec
@ -314,11 +314,11 @@ def check_file_version(filename):
|
|||||||
# Convert the string timestamp to a datetime object
|
# Convert the string timestamp to a datetime object
|
||||||
file_timestamp = datetime.strptime(timestamp_str, '%Y-%m-%d %H:%M:%S')
|
file_timestamp = datetime.strptime(timestamp_str, '%Y-%m-%d %H:%M:%S')
|
||||||
|
|
||||||
# Get the last modified time of the file
|
# Get the last modified time of the file, ignoring milliseconds
|
||||||
file_modified_time = datetime.fromtimestamp(os.path.getmtime(filename))
|
file_modified_time = datetime.fromtimestamp(os.path.getmtime(filename)).replace(microsecond=0)
|
||||||
|
|
||||||
# Compare the timestamps
|
# Compare the timestamps
|
||||||
if file_modified_time > file_timestamp:
|
if file_modified_time > (file_timestamp):
|
||||||
return f"{filename}.new"
|
return f"{filename}.new"
|
||||||
else:
|
else:
|
||||||
return filename
|
return filename
|
||||||
|
Loading…
Reference in New Issue
Block a user