You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
811 B
Python
24 lines
811 B
Python
import os
|
|
|
|
class Config:
|
|
RANGE_NUM: int = 100
|
|
WORK_PATH = "E:/商品资料汇总/商品资料(1151-1200)"
|
|
# WORK_PATH = "C:/Users/Administrator/Desktop/测试"
|
|
|
|
INPUT_PATH = ""
|
|
# INPUT_PATH = "E:/商品资料汇总/商品资料(1101-1150)/ppt1135-世界海洋日"
|
|
|
|
@staticmethod
|
|
def get_latest_folder(base_directory):
|
|
if Config.INPUT_PATH is not None and Config.INPUT_PATH != "":
|
|
return Config.INPUT_PATH
|
|
folders = [
|
|
os.path.join(base_directory, d)
|
|
for d in os.listdir(base_directory)
|
|
if os.path.isdir(os.path.join(base_directory, d))
|
|
]
|
|
if not folders:
|
|
return None
|
|
latest_folder = max(folders, key=os.path.getctime) # 获取最新创建的文件夹
|
|
return latest_folder
|