python利用shutil.move实现移动原文件夹文件至新文件夹并实现新文件夹文件存在情况下覆盖写入并输出至log日志

import os

import shutil

import logging

from datetime import datetime

import configparser

import io

import codecs

import sys

import time

with codecs.open('config.txt','r', encoding='utf-8-sig') as f:

    sample_config = io.StringIO(f.read())

   

config = configparser.ConfigParser()

config.read_file(sample_config)


 

now = datetime.now()

dt_string = now.strftime("%Y-%m-%d %H:%M:%S")

logge = time.strftime('%Y-%m-%d', time.localtime(time.time()))

logging.basicConfig(filename='log/'+logge + ".log ", filemode="a", level=logging.INFO)

target_folder = config.get("file","file_dir")

target_folder1 = config.get("file","file_dir1")

你可能感兴趣的:(python)