mirror of
https://github.com/RedDeadDepresso/KKAFIO.git
synced 2025-12-22 17:30:01 +00:00
fix: rename source path
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
import shutil
|
import shutil
|
||||||
import datetime
|
|
||||||
import patoolib
|
import patoolib
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from util.logger import logger
|
from util.logger import logger
|
||||||
from typing import Union, Literal
|
from typing import Union, Literal
|
||||||
@@ -70,8 +70,9 @@ class FileManager:
|
|||||||
for attempt in range(max_retries):
|
for attempt in range(max_retries):
|
||||||
try:
|
try:
|
||||||
logger.renamed(type, base_name)
|
logger.renamed(type, base_name)
|
||||||
new_name = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S-%f')
|
new_stem = f"{source_path.stem}_{datetime.now().strftime('%Y-%m-%d_%H-%M-%S-%f')}"
|
||||||
destination_path = destination_path.with_stem(f"{destination_path.stem}_{new_name}")
|
source_path = source_path.rename(source_path.with_stem(new_stem))
|
||||||
|
destination_path = destination_path.with_stem(new_stem)
|
||||||
break
|
break
|
||||||
except PermissionError:
|
except PermissionError:
|
||||||
if attempt < max_retries - 1:
|
if attempt < max_retries - 1:
|
||||||
|
|||||||
Reference in New Issue
Block a user